Maximum Contiguous Subarray Sum Leetcode Javascript