
Welcome to Node.js v13.8.0.
Type ".help" for more information.
{a:1}['a'] === 1
false
{a:1}['a'] === 1
true (have not press enter, if press enter it turns to false)
I tested on Chrome, it always shows false. I'm sure this is a bug.
Type {a:1}['a'] === 1 in a node console.
Every time.
The gray font of 'true' in this image should be 'false'!
@BridgeAR
The two ways this is parsed:
({ a: 1 }['a'] === 1); in preview{ a:1; }; ['a'] === 1; in repl evalWe should probably eagerly try to wrap all input in parens in the actual evaluator.
Mind if i take a stab at this one?
We should probably eagerly try to wrap all input in parens in the actual evaluator.
That might break working code, or am I missing something?
class Foo {} function foo() {} contains two valid declarations, but not if wrapped as an expression in parentheses.
@tniessen if the code isn't valid with parens, parens are not used. the logic should more or less be: try { parse(wrap(input)); input = wrap(input); } catch {}
Most helpful comment
Mind if i take a stab at this one?