DEV Community

Discussion on: 1 line of code: How to check if an Array is empty

Collapse
 
joaolss profile image
João Lucas Silva

Why use the not operator (!) when you can simply invert the ternary? For one use this is negligible, but it can sum up to hurt performance, and also makes the code less readable

Collapse
 
martinkr profile image
Martin Krause

You are completely right - I adjusted the code.
Thank you!

Some comments have been hidden by the post's author - find out more