The empty statement returns nothing at all (empty: “no value of any type”). A statement list, like the one in the body of a Script that eval
is parsing the code as, returns the value of the last statement that did return anything:
The value of a StatementList is the value of the last value-producing
item in the StatementList. For example, the following calls to the
eval function all return the value 1:eval("1;;;;;") eval("1;{}") eval("1;var a;")
An empty statement list, empty script, empty block, or statement list containing no value-producing statements evaluates to empty.
The PerformEval operation then converts that empty value to undefined
in step 30:
If result.[[Type]] is
normal
and result.[[Value]] isempty
, then
Set result to NormalCompletion(undefined
).
0
solved What value does the empty statement evaluate to?