Maximum Contiguous Subarray Dynamic Programming In Javascript