Bit Manipulation Leetcode Problems Javascript For Loop