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 Working with Classes in JavaScript Writing Your First Class

Mike Hatch
Mike Hatch
14,940 Points

Are JavaScript Classes Controversial or Widely Accepted?

Those of you who follow Kyle Simpson (author of the very popular You Don't Know JavaScript book series) will know he's not a fan of classes in JavaScript. To understand why, you can read about it in his this & Object Prototypes book.

Is it one of those things that's best to learn for now, but could change in the future?

Antti Lylander
Antti Lylander
9,673 Points

Very interesting question, I'm following.

1 Answer

Jordan Hoover
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jordan Hoover
Python Web Development Techdegree Graduate 59,265 Points

Definitely not an expert on this, but part of the problem is its a wrapper on prototypes, which is how JS is really supposed to work. Ie. classes are for people who don't know JS...

However, frameworks like React are using it, so I'd definitely say it could be useful to know how OOP works in Javascript. Its also a very good thing to know for programming in general as many other languages use it as their primary orientation, such as Java, C++, PHP.

Mike Hatch
Mike Hatch
14,940 Points

Thank you, Jordan. It sounds like you're in favor to the addition of classes to Javascript based on how they're used in React. I don't know React yet, and this question was geared towards Vanilla Javascript.