Substrings Of Size Three Leetcode Problems Javascript Map Function