those are bad advises. Even for some reason one won't use just value check, one can use Set, not Array for checking membership.
1
ternaries? evaluation: bad
1
My number one tip for writing better conditionals is stop writing conditionals.
1
IMHO, 4th approach is not efficient, because there is must discussion between strong and lazy initialization. If you use *switch*, in this manner you allocate values in memory and use when you need, and after work done, they will be destroyed by GC. In case of *cache* – not.
40%Agree
60%Disagree
15 votes • Final results
Hi @Arthur77664037 , author here. Moved out those const already. 😉
It's a pity that performance was not included in "what's better". For example it seems to me that if's are faster than include. jsperf.com/array-includes-vs…