2 ms·
This is valid JS: 1; 2; alert("returns undefined"); confirm("return true or false?") (function() {return 3})(); (function() {})(); Wha
by afandian 12y ago
This is valid JS:
1;
2;
alert("returns undefined");
confirm("return true or false?")
(function() {return 3})();
(function() {})();
What's being done with the values of 1, 2, undefined, true/false, 3 and undefined? Nothing if they're not assigned. But as every function returns a value and invocations are therefore an expression, it would be impossible to disallow expressions to be evaluated but not assigned.