mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-06 08:09:45 +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);
|
|
}
|