var
a = 10, b = 5, c = -10, res =
null
;
function
funMake() {
// +
res = a + b;
document.write(a +
' + '
+ b +
' = '
+ res +
'<br /><br />'
);
// -
res = a - b;
' - '
// *
res = a * b;
' * '
// /
res = a / b;
' / '
'<br />'
/*you cannot divide by zero*/
res = a / 0;
+ 0 +
// %
res = a % 3;
' % '
+ 3 +
res = a % 0;
res = a % 50;
+ 50 +
document.write(c +
document.write(+c +
document.write(-a +
// ++a
a = 10;
document.write(++a +
// a++
document.write(a++ +
// --a
document.write(--a +
// a--
document.write(a-- +
document.write(a);
}
var a = 10, b = 5, c = -10, res = null; function funMake() { // + res = a + b; document.write(a + ' + ' + b + ' = ' + res + ''); // - res = a - b; document.write(a + ' - ' + b + ' = ' + res + ''); // * res = a * b; document.write(a + ' * ' + b + ' = ' + res + ''); // / res = a / b; document.write(a + ' / ' + b + ' = ' + res + ''); /*you cannot divide by zero*/ res = a / 0; document.write(a + ' / ' + 0 + ' = ' + res + ''); // % res = a % 3; document.write(a + ' % ' + 3 + ' = ' + res + ''); /*you cannot divide by zero*/ res = a % 0; document.write(a + ' % ' + 0 + ' = ' + res + ''); res = a % 50; document.write(a + ' % ' + 50 + ' = ' + res + ''); // + document.write(c + ''); document.write(+c + ''); // - document.write(a + ''); document.write(-a + ''); // ++a a = 10; document.write(++a + ''); document.write(a + ''); // a++ a = 10; document.write(a++ + ''); document.write(a + ''); // --a a = 10; document.write(--a + ''); document.write(a + ''); // a-- a = 10; document.write(a-- + ''); document.write(a); }
<!DOCTYPE html>
<
html
>
head
meta
charset
=
"utf-8"
/>
title
>New Page</
script
src
"js/script.js"
></
</
body
funMake();