I too was salty about the update, but found this :D!
Not sure if speed is key in such a situation, but using an .indexOf() (or .includes() if you want to be all ES6) is faster than setting variables and using a .forEach(). Also, instead of using an if else, we can just use a ternary operator!
I too was salty about the update, but found this :D!
Not sure if speed is key in such a situation, but using an
.indexOf()
(or.includes()
if you want to be all ES6) is faster than setting variables and using a.forEach()
. Also, instead of using anif else
, we can just use a ternary operator!