Subsequence And Subarray Javascript Error Fix