4JSB Javascript Tuesday, 30th April 2013

Today was the first lesson of 4JSB, I learnt a few things about Javascript.
  • Variables don't need datatypes and can change datatypes
  • parseInt(); to convert a string to an integer
  • .toFixed(2); to output a decimal number to a certain number of decimal places
  • var func = function(param){}; to create a function
  • document.write("hello " + 2); to write something to the document
  • alert("ERROR"); to make an alert box pop up
  • prompt("Enter your name", "luke"); to request input from the user via prompt box
  • confirm(); prompts the user to confirm something
  • variables are declared as "var variableName;"

Was this helpful?

Yes No


Comments