First Duplicate Value Leetcode Javascript Question