Count Steps Leetcode Javascript Question