Apply Method In Javascript 1752 Leetcode