Leetcode Basic Problems In Javascript Object Array Typeof