DEV Community

Cover image for The most common issue I see in new programmers code
Vasily Polovnyov
Vasily Polovnyov

Posted on

The most common issue I see in new programmers code

Is this:

const isEmbedded = className.indexOf('embedded') > -1 ? true : false
Enter fullscreen mode Exit fullscreen mode

Which can be fixed like this:

const isEmbedded = className.indexOf('embedded') > -1
Enter fullscreen mode Exit fullscreen mode

Or, even better:

const isEmbedded = className.includes('embedded')
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
vdleije profile image
Jeffrey vd Leije

Love the last solution! ✌

Collapse
 
andreieres profile image
Andrei Eres

It’s true