Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Object-Oriented JavaScript (2015) Prototypal Inheritance Updating the Song Object

Nicholas Gaerlan
Nicholas Gaerlan
9,501 Points

So... I can just ignore all this until we cover 'class' and 'extends'???

this seems like the most duct-taped way of shoe-horning OOP inheritance into a scripting language. It has got to get better. I see the examples are not using arrow functions or template literals, so... maybe class and extends are omitted because at this point we're covering the 'hard' way to do it?

1 Answer

Steven Parker
Steven Parker
231,275 Points

Prototypical inheritance is certainly different from most languages, but I'm not sure I'd call it the "hard way". And while recent additions to the language provide other ways that may seem more familiar to users of other languages, they're not necessarily easier once you've understood the conventional method.

If you ever watch any of the lectures by Douglas Crockford, one of the most well-known proponents of JavaScript, you'll hear him explain how not all of the "new" stuff is better than some of the traditional language features. These can be readily found on YouTube and elsewhere.

Nicholas Gaerlan
Nicholas Gaerlan
9,501 Points

Thanks for the recommendation. I watched some of his latest stuff from this year "Post JavaScript Apocalypse" talks. He's given a few of them. The premise of it is that he hopes JavaScript is not the final answer, and then goes on to point out some fundamental shortcomings of JS and confusing parts of it. He even says "JavaScript is everywhere. It's now the most used langauge. No one expected or wanted it [to be that way].". To be fair, I think he may have been talking about shortcomings common to ALL languages. From what you wrote, he probably had a different talk around the time of ES2015. JS is ok. I don't think it's a well designed language at all, but it's got the biggest base of users who figure out ways to extend its features with libraries and frameworks. It's pretty low on my list of languages I like, but I feel I have to learn it because it's everywhere. Maybe I'll end up liking it more after playing with it for a few months. I instantly loved Python, Go, C++, PHP, and SQL. I want to get around to Swift, Rust, and some sort of Lisp (RamdaJS? Scala? Clojure?) out of curiosity. I don't like C#, Java, or Ruby.

Steven Parker
Steven Parker
231,275 Points

Interesting. I agree with you on Python, Go and C++. But I also like C# and JavaScript (though not as much as the others). And I dont' like SQL though I use it all the time. I haven't learned the others (yet).