On 2016-04-13 19:53, Vic99999 <[email protected]> writes: > if "{}+{}" is a statement, than how can it return (or yield) a result?
It returns a completion record, like every other construction (http://www.ecma-international.org/ecma-262/6.0/#sec-completion-record-specification-type). In most cases you don't get to see the value inside, but you can get to it through eval. In fact, I often use eval when I don't know if a console is running my code as an expression or as a statement, as eval runs code as programs. Running eval("{}+{}") and eval("({}+{})") nicely shows the two correct results, which boils down to whether {} is a block (http://www.ecma-international.org/ecma-262/6.0/#sec-block) with a single empty statement, or if it's an object literal. Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7 Monthly Athmospheric CO₂ (2016-03, Mauna Loa Obs.): 404.83
signature.asc
Description: PGP signature
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

