Leetcode Problems Two Sum Solution Javascript Substring Vs Slice