Alternative syntax with Literal Object:
const x = 0; const height = { [true]: 0, [x < 100]: 100, [100 <= x && x < 200]: 200, [x >= 200]: 250, }[true]; console.log(height); // you can see "100"
Alternative syntax with Literal Object:
const x = 0; const height = { [true]: 0, [x < 100]: 100, [100 <= x && x < 200]: 200, [x >= 200]: 250, }[true]; console.log(height); // you can see "100"