declaring functions with var in javascript code example
Example 1: declare function javascript
function myFunction(var1, var2) {
return var1 * var2;
}
Example 2: js store function in variable
var foo = function(a){ return a * 2; }
var bar = foo(2);
foo = function(a){ return a / 2; }
bar = foo(bar);