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 trialsierra torres
342 Pointswhats a constants main purpose
like how do you use it in code
constant = favoriteDessert
string = ''pine apples''
2 Answers
Alejandro Soria
1,101 PointsHi! You have to use "let" to declare a constant (not "constant") and remove the "=". Also, make sure you use "" instead of ' ' in your string. Hope that helps!
Michel Ortega
2,279 PointsThe main purpose of a constant is to help with the memory while running the program. In this case, if you know that a value won't change, set it as a constant so the performance of the program (e.g. an app) is optimized.