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 Practice Object Interaction The Rough Plan Solution: Building Constructor Methods

Routine Poutine
Routine Poutine
26,050 Points

Classes in JavaScript vs. TypeScript

Hi,

Are classes in JavaScript the same thing as classes in other languages? Is this a feature one should regularly use? Is it better to learn TypeScript and use its class system? I'm new to this, always writing objects that are not classes, but want to expand into this area. Thanks.

1 Answer

Steven Parker
Steven Parker
231,269 Points

Classes become handy when you need to create a number of objects that are all similar. Code that creates single objects with literals wouldn't really be improved with classes.

And the implementation of classes does vary between different languages. The basic concept will likely be similar, but the mechanisms and level of integration into the language will differ.

And TypeScript essentially adds a few extra rules to JavaScript, so nearly everything you learn about JavaScript should still apply.