DEV Community

Discussion on: 🤔Pop Quiz! Which of these is an infinite loop?

Collapse
 
metruzanca profile image
Samuele Zanca

That 5x3 loop surprised me. But the breakdown of it makes sense.

These sort of challenges always make me laugh as they're really tricky sometimes meanwhile they're examples of what not to do when writing JavaScript. Anti-patterns to an extent. And the principal anti-pattern for js is var. Var is to be considered deprecated for all intense and purposes. Only to be used by pre-compilers and the alike.
And while vat never(or should never) be used in practice, it's still used in coding challenges because it's tricky behavior makes you really question your understanding under the hood of JavaScript.