-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
I tried this in your online demo with constant evaluation enabled:
console.log(2 + 2 * 2);
console.log('abcdefgh'[4]);
console.log({a:'b'}['a']);
The result is:
console.log(6),console.log("abcdefgh"[4]),console.log({a:"b"}.a)
Only the first (numeric) expression was optimized. I would expect all of them to be evaluated.
This should be a safe transformation if only someone didn't override Array or Object constructor. (Note that accessing non-plain object's properties is not safe as they might have a getter.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels