Case 1:
function square(x) { return x*x; }
var s = square(); // Invoking with parentheses
console.log(square(2));
console.log(s(2));
Case 2:
function square(x) { return x*x; }
var s = square;// invoking without parentheses
console.log(square(2));
console.log(s(2));
Functions are always supposed to be invoked with (). Then why does it return undefined in case 1 , but works fine in Case 2?
s(2), not ins = square!? There's no argument as well.Unhandled Error: 's' is not a functionfor your Case 1.