Leetcode Subarray Products Hackerrank Javascript Test