Eval ("{}") vs eval ("x = {}"), returns undefined while the others {}
{}
interpreted as a block with no statements, which evaluates to undefined
. x={}
force {}
evaluates to an expression (empty object) because you cannot assign a block to anything. The assignment operator then returns the value that was assigned.
A cleaner way to get the same effect is to copy the expression in parentheses. eval("({})")
gives the correct result for me.
source to share
Eval ("{} + {}")
JavaScript has a lot of bugs.
Source: https://www.destroyallsoftware.com/talks/wat
source to share