![]() All of the discussions around ternaries are for the form ```js cond1 ? elem1_if : cond2 ? elem2_if : elem_else ``` but some of them are for the form ```js cond1 ? cond2 ? elem2_if : elem2_else : elem1_else ``` which is more rare and would be good to call out by adding parenthesis. ```js cond1 ? (cond2 ? elem2_if : elem2_else) : elem1_else ``` Note that we only want parenthesis if it's written inline, otherwise the indentation is good enough to understand the flow: ```js cond1 ? cond2 ? elem2_if : elem2_else : elem1_else ``` |
||
---|---|---|
.. | ||
__snapshots__ | ||
jsfmt.spec.js | ||
parenthesis.js | ||
test.js |