mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 18:35:07 +00:00

When evaluating logical binop expressions, the rhs must not be evaluated if the lhs leads to the whole expression not being truthy.
15 lines
244 B
JavaScript
15 lines
244 B
JavaScript
function assert(x) { if (!x) throw 1; }
|
|
|
|
try {
|
|
let foo = 1;
|
|
false && (foo = 2);
|
|
assert(foo === 1);
|
|
|
|
foo = 1;
|
|
true || (foo = 2);
|
|
assert(foo === 1);
|
|
|
|
console.log("PASS");
|
|
} catch (e) {
|
|
console.log("FAIL: " + e);
|
|
}
|