Leetcode Basic Problems In Javascript Object Methods