DEV Community

loading...

Discussion on: 6 Nullish coalescing operators every javascript programmer must know !

Collapse
gleaming_cube profile image
Darren Harding

Great post. My personal preference would be to use .some() instead of .includes() as it will return early as soon as it resolves true, where .includes() will go through every item in the array when it probably doesn't need to. I would also agree that nested ternary is very hard to read so I would probably avoid that if I had to nest multiple conditions and just fall back to good old fashioned if/else.

But this is really useful, thank you.

Collapse
sudarshansb143 profile image
Sudarshan Sawandkar Author

Thanks for your feedback !