samedi 3 août 2019

JavaScript, how to continue expression on the next line

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  

Aucun commentaire:

Enregistrer un commentaire