Javascript examples for Function:Function Definition
A JavaScript function can also be defined using an expression.
<!DOCTYPE html> <html> <body> <p>A function can be stored in a variable:</p> <p id="demo"></p> <script> var x = function (a, b) {return a * b}; document.getElementById("demo").innerHTML = x; </script>//from w w w . ja va 2 s . co m </body> </html>