When it comes to performance, never listen to anyone who tells you using some feature of JavaScript is slow (unless they tell you it's slow in an old version of a browser like IE8). Inevitably, one of the following will be true:
-
X was slower than Y, but it isn't anymore.
-
X is slower than Y, but it doesn't matter because that's not where your performance bottleneck is.
-
X is slower than Y, but when the browsers auto-update tomorrow, X could be faster.
For example, we all know switch is slow. (Go ahead and follow the link. I'll wait.) Ooops. I hope you didn't spend a lot of time removing switches or complicate your code based on someone else's advice. If you did, I hope you did it because you had profiling data that proved that your performance bottleneck was the switch statement. Yea, that didn't happen. Well, at least you were following a [best practice](https://en.wikipedia.org/wiki/Cargo_cult_programmin