In ES6 you can also do
Object.assign which pretty much does the same thing as Underscore's
_.extend. I think Lodash is generally preferred to Underscore these days as well (but they're basically the same in functionality). The downside with this 'mixin' approach is memory usage.
function Scene_MenuBase() {}function Scene_Menu() {}Scene_Menu.prototype = Scene_MenuBase;var menu = new Scene_Menu();
I should have noticed this earlier, but setting a constructor's
.prototype to a function (even if it is a constructor) is a very bad idea. I mean your newly-created object would inherit methods from
Function.prototype which makes no sense. If you did `
menu instanceof Function` it would return
true, and `
menu instanceof Scene_MenuBase` would return
false, enough said.
The closest thing that would make any sort of sense is `
Scene_Menu.prototype = Scene_MenuBase.prototype;`, but even this is pretty messed up and shouldn't be used for many reasons.
This is not the way to go about inheritance in JavaScript. Go through the course I linked further up, they explain things much better than I can,