A JavaScript function can also be defined using an expression. - Javascript Function

Javascript examples for Function:Function Definition

Description

A JavaScript function can also be defined using an expression.

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials