T3A09-Functions-by-Abhay Version 1.7.24

T1A09-functions-by-Abhay.html

Good reference to Javascript functions
Functions are used to sensibly organzie code. Then they are "Called" elsewhere. Information can also be passed to functions (that's more advanced).

Example Functions code

function myGrabNumber(){
   return parseInt(document.getElementById('myText01').value)
}

Example working code



...


This example calls a function to convert from Fahrenheit to Celsius:





Click to slide down panel
Yes, it actually worked!!!!!








...



This example calls a function which performs a calculation and returns the result:

This function generates a random number (Refresh page for a new random number.)