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!
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
Stefan SchrabergerFront End Web Development Techdegree Student 8,873 Points
Should Objects also be declared using let or const?
Just to be sure. I have learned that var is obsolete for declaring variables or arrays. Is the same thing true for objects?
Wiktor Bednarz18,647 Points
It is widely accepted that var declaration shouldn't be used at all by this point. Const or let should be used for declaring ANY data type variables and even functions. You should be choosing which one to use based only on the lifecycle and scope of your variable. However if you want to get deeper into the topic, I'd suggest reading up this article:
Jason AndersTreehouse Moderator 145,840 Points
Just to add a note to Wiktor Bednarz response, you'll find that with ES6, objects are more and more being created using Classes. You can have a quick read on classes here.
That was a great question for the Community. Thanks for asking it! :)
Antonio Ascue Avalos3,023 Points
Thank you for the question and the answer
Łukasz Tomaszewski3,407 Points
Great question! Thanks for answers!