Files
rust_browser/tests/external/js262/fixtures/ternary-short-circuit.js
Zachary D. Rowitsch 963ac860d2
Some checks failed
ci / fast (linux) (push) Failing after 12m31s
Add JavaScript ternary operator (? :) support
Implements the conditional/ternary operator across tokenizer, parser, and
VM with correct precedence (between assignment and logical-or),
right-associativity, short-circuit evaluation, and nesting depth guard.
Promotes js262-ternary-operator to pass and adds 3 new conformance tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 09:24:35 -05:00

9 lines
145 B
JavaScript

// Only the taken branch should be evaluated
var x = 0;
true ? x = 1 : x = 2;
console.log(x);
var y = 0;
false ? y = 1 : y = 2;
console.log(y);