Leetcode Javascript Class Inheritance Base