Second Maximum Element In Array Leetcode Problems Javascript