Section A.2. Chapter 3


A.2. Chapter 3

  1. The solution is:

  2. var resultOfComp = (valA - valB) % 3 / 2 * (4 + valC) - 3;

  3. The solution is:

  4. switch(val) {    case 'one','two' :       result = 'OK';      break;    case 'three' :      result = 'OK2';      break;    default :      result = 'NONE'; } 

  5. The solution is:

  6. if ((varOne == 33) && (varTwo <= 100) && (varThree > 0))... 

  7. 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:

  8. for (var i = 11; i < 20; i++) {   document.writeln(i + "<br />"); } 

  9. And hereâ??s how to reverse the count:

  10. for (var i = 19; i > 10; i--) {   document.writeln(i + "<br />"); }




Learning JavaScript
Learning JavaScript, 2nd Edition
ISBN: 0596521871
EAN: 2147483647
Year: 2006
Pages: 151

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net