According to the ECMA-262 Specification, the following statements return 1
:
eval("1;;;;;")
eval("1;{}")
eval("1;var a;")
Ensuring that:
The value of a StatementList is the value of the last value producing Statement in the StatementList.
Can you explain these different returns ?
eval("{}") // undefined
eval("var a={}; a;") // {}
eval("var a={};") // undefined
What is the difference between 1;
and {};
?