topical media & game development

talk show tell print

basic-javascript-03-ch3-examp4.htm / htm



  <html>
  <body>
  
  <script language="JavaScript" type="text/javascript">
  
  var degFahren = new Array(212, 32, -459.15);
  var degCent = new Array();
  var loopCounter;
  
  for (loopCounter = 0; loopCounter <= 2; loopCounter++)
  {
     degCent[loopCounter] = 5/9 * (degFahren[loopCounter] - 32);
  }
  
  for (loopCounter = 2; loopCounter >= 0; loopCounter--)
  {
     document.write("Value " + loopCounter + " was " + degFahren[loopCounter] + 
                    " degrees Fahrenheit");
     document.write(" which is " + degCent[loopCounter] + 
                    " degrees centigrade<BR>");
  }
  
  </script>
  
  </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.