Some checks failed
ci / fast (linux) (push) Failing after 12m31s
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>
12 lines
256 B
JavaScript
12 lines
256 B
JavaScript
// Ternary with various operators and function calls
|
|
function double(n) { return n * 2; }
|
|
|
|
var a = 1 > 0 ? double(5) : double(10);
|
|
console.log(a);
|
|
|
|
var b = 0 || false ? "truthy" : "falsy";
|
|
console.log(b);
|
|
|
|
var c = true && 1 ? "yes" : "no";
|
|
console.log(c);
|