4 ms·
You are missing the point; if you use JavaScript, you use prototypal inheritance whether you like it or not, e.g.: function getUser() {} That is creating a
by thinkxl 9y ago
You are missing the point; if you use JavaScript, you use prototypal inheritance whether you like it or not, e.g.:
function getUser() {}
That is creating an instance of the `Function` constructor object[1][2]. In a Classical (as classes) language, you would see that like this:
// `Function` being a class
function getUser extends Function {}
but because JavaScript is purely prototypal, this works differently.
You say that there's no reason to learn prototypal inheritance, well, the only and valid reason is that to write at least decent JavaScript you have to understand how it works behind the scenes.
* [1] - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
* [2] - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Edit: add links