Articles → JavaScript → Anonymous Function In Javascript
Anonymous Function In Javascript
Purpose
Example
<html>
<head>
<title>Anonymous function demo</title>
<script>
// Assigning function to a variable
var anony = function(a, b) {
alert(a + b);
};
// Calling variable as function
anony(4, 3);
</script>
</head>
<body> </body>
</html>
Output
Click to Enlarge