Javascript Downcast (es6 to es5)