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 trialJAE IN KIM
Front End Web Development Techdegree Student 6,794 PointsI don't know why I need to switch const to var..those two have different name for tag.
const points = 100; const bonusPts = 50;
points += bonusPts; console.log(points);
const points = 100;
const bonusPts = 50;
points += bonusPts;
console.log(points);
3 Answers
Fran ADP
6,304 PointsThe const variable is for not changing things, it is constant, and var is for variables, things that change.
Mark Sebeck
Treehouse Moderator 37,777 PointsThe value of a 'const' can not be changed. So in your example bonusPts could be a 'const' but since you are changing the value of points it can not be a 'const'. BTW the new standard in JavaScript is to use 'let' instead of 'var'. Hope this clears up the confusion.
JAE IN KIM
Front End Web Development Techdegree Student 6,794 Pointsyesterday when I read your comment, I didn't get it......but today morning I just got 'ah' moment! Now I remember that 'const' is not for sport scoring system as you said ' the value of const can not be changed. thank you!
Casey Peterson
1,865 PointsIs anybody on to help me figure out how the this is supposed to look?
Mark Sebeck
Treehouse Moderator 37,777 PointsYou just need to chance the const to a var or let. Constants can't change just variables. let is the new javascript standard for variables but var still works.
JAE IN KIM
Front End Web Development Techdegree Student 6,794 PointsJAE IN KIM
Front End Web Development Techdegree Student 6,794 Pointsthank you for your comment. I just got what const variable is! I will remember it is not for chaning things!