Passing values :
var myFunc = function(x) { return x * x; }; console.log(myfunc(3)); // → 9
Without passing values :
var myFunc = function() { console.log("My func was called") }; console.log(myfunc()); // → "My func was called"
Solutions for developers
Passing values :
var myFunc = function(x) { return x * x; }; console.log(myfunc(3)); // → 9
Without passing values :
var myFunc = function() { console.log("My func was called") }; console.log(myfunc()); // → "My func was called"