Is there a way to continue expression on the next line in JS?
const result = 'one' ? 1 :
'two' ? 2 :
3
turn it into
const result = \
'one' ? 1 :
'two' ? 2 :
3
and turn this
return condition1 &&
condition2 &&
condition3
into
return \
condition1 &&
condition2 &&
condition3
So it would looks better?
It's possible to do it like that but I hope there are better way
return true &&
condition1 &&
condition2 &&
condition3
Your first desired snippet
const result =
'one' ? 1 :
'two' ? 2 :
3
is already allowed, but due to automatic semicolon insertion (ASI), the return statement must be written as:
return (
condition1 &&
condition2 &&
condition3
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With