4 ms·
Which is easier, explaining to your hypothetical total beginner what "Person.prototype" is and going down the rabbit hole of prototype-inheritance, and explaini
by ubertaco 9y ago
Which is easier, explaining to your hypothetical total beginner what "Person.prototype" is and going down the rabbit hole of prototype-inheritance, and explaining how Javascript functions (unlike just about every other language's functions) can have attributes on them and can act like fake constructors and what "this" means in your example (and then later what it means in a different case, since it means so many different things)...or simply saying "yeah, we can define a new category, or 'class', of things called Person by saying 'class Person { ....'"?
- erikpukinskis 9y agoYou only think "class" is self explanatory because you already learned what it means.
- ubertaco 9y agoYes, but plenty of other non-programmers also learned what it means, when they first heard the English word. So it's not a huge conceptual leap. Whereas "prototype" has completely different English dictionary meaning, and thus requires in-depth redefinition.