//Named function
function multiply() {
var result = 3 * 4;
console.log("3 multiplied by 4 is ", result);
}
multiply()
//anonymous function
var divided = function() {
var result = 10 / 2;
console.log("10 divided by 2 is ", result)
}
divided();
//Immediately invoked functional expressions
(function() {
var result = 3 + 4;
console.log("3 plus 4 is: ", result)
}())
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter