I was trying to optimize my JS code today by simplifying complexity of my loops, and I got an idea to use one trick. The trick is I flipped the array into an object and chec