Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
220,634 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
220,634 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).