Leetcode Javascript Class Inheritance Example