From http://www.html-js.com/article/JavaScript-mode-in-JavaScript-class-inheritance-mode