Ecma262: Updates to Ternary Operator

Created on 31 Jan 2019  路  2Comments  路  Source: tc39/ecma262

Hi i think a good update to the ternary operators could be an even shorted version of what we have now as for example

variable_a.item ? variable_a.item : variable_b.item

could be shortened to something along the lines of

variable_a.item ?: variable_b.item
or
variable_a.item :? variable_b.item

this would stop the repetition of the first variable meaning for cleaner looking code and i don't think it is that hard to mis read and interpret differently if you are skimming code.

feature suggestion

All 2 comments

This exists; it鈥檚 the || operator.

oh god sake im an idiot lol ill close this then

Was this page helpful?
0 / 5 - 0 ratings