DEV Community

Discussion on: 17 Javascript optimization tips to know in 2021 🚀

Collapse
 
kpmcdowellmo profile image
Keven McDowell

This list contains some good tips. Using an object in place of a switch statement is one of my favorite tricks to use. For your first tip, you may want to also consider using an object, since Array.includes is at worst a O(n) operation compared to an object lookup, which is a O(1) operation.