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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![monique champagne](https://uploads.teamtreehouse.com/production/profile-photos/11707230/micro_IMG_1160.jpg)
monique champagne
761 PointsConfused about using const here..
read the other users questions about this same thing but still not sure i understand why const can be used here even after reading these responses.. what is constant here if the number keeps changing?
is it like- declaring a variable with const is like creating a box that you can put things in and out of.. the box is- lets say, called const myBox & the things we put inside of it are toys.. so
const myBox = ["hula hoop", "puzzle", "checkers"]; so you can add more toys to the box (like using the push() method), but you cant- do what?? thats the part im getting lost at- what makes this different than using let?
is it so that somewhere down the line you dont use myBox again for some other random thing?
confused...
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsWhat's "constant" is the variable itself, not the object it refers to. So for example:
const myBox = ["hula hoop", "puzzle", "checkers"];
myBox.push("chess"); // adding an item to the array is allowed
myBox = 42; // but reassigning the variable is not!
![monique champagne](https://uploads.teamtreehouse.com/production/profile-photos/11707230/micro_IMG_1160.jpg)
monique champagne
761 Pointsso you CAN change the contents of the box totally -
ie- using splice you can get rid of all current toys and put all new toys in seemingly "changing" the contents entirely so that it is nothing like the original -
but you cant do this (change the contents) without actually modifying the original contents...
you also cant just "reassign" it all together... skipping the steps of modifying the original contents.. ?
Steven Parker
230,688 PointsSteven Parker
230,688 PointsModifying the contents isn't a "step" to reassigning. If it's a normal (not const) variable, you can reassign it at any time.
So if you have a const array, you can change what's in the array, but it will always be an array. You can't re-use it to hold a number or a string, for example.