Chapter 3
The solution is:
var resultOfComp = (valA - valB) % 3 / 2 * (4 + valC) - 3;
The solution is:
switch(val) { case 'one','two' : result = 'OK'; break; case 'three' : result = 'OK2'; break; default : result = 'NONE'; }
The solution is:
if ((varOne == 33) && (varTwo <= 100) && (varThree > 0))...
and 5. In
for
loops, you donâÂÂt have to start at 0 or 1, and you also donâÂÂt have to increment the number. HereâÂÂs how to count upward between 10 and 20:for (var i = 11; i < 20; i++) { document.writeln(i + "<br />"); }
And hereâÂÂs how to reverse the count:
for (var i = 19; i > 10; i--) { document.writeln(i + "<br />"); }
Get Learning JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.