Max Consecutive Ones I Leetcode Problems Javascript