Third Maximum Element Leetcode Problems Javascript Array