Leetcode Subarray Products Hackerrank Javascript Coding