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 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,686 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,268 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.