First Duplicate Value Leetcode Javascript