First Duplicate Value Leetcode Problems Javascript