Next Smaller Element Leetcode Javascript Solution