Method 1:
function multiply(x,y) {
return (x * y);
}
console.log(multiply(4,2));
// Outputs: 8
Method 2:
var multiply = function(x,y) { return (x * y); }
console.log(multiply(2,4)); //output: 8
Method 3:
//The same function but with a self execution to set the value of the variable:
var multiply = function(x,y) {
return (x * y);
}(4,2);
console.log(multiply);
//output: 8

Leave a comment