Skip to content

LHS should be evaluated first in the assignment. #1745

@akroshg

Description

@akroshg
(function() {
    var x = 1;
    (function() {
        x = (eval('var x = 20'), 2);
        console.log(x == 20); // this should be true
    })();
    console.log(x == 2); // this should be true
})();

Both should print true. (Edge/Chrome don't but Firefox does)
see https://tc39.github.io/ecma262/#sec-assignment-operators-runtime-semantics-evaluation

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions