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)
![Joshua Martin](https://uploads.teamtreehouse.com/production/profile-photos/10379562/micro_Screen_Shot_2019-02-17_at_5.54.29_PM.jpg)
Joshua Martin
18,331 PointsCan you explain the why behind variables inside of var?
Can anybody explain why you would create variables inside of other variables, and give some examples? Thanks! Jiles
1 Answer
![Tushar Muhammad](https://uploads.teamtreehouse.com/production/profile-photos/10693828/micro_krillin_400x400.jpg)
Tushar Muhammad
Full Stack JavaScript Techdegree Student 508 PointsVariables are never created inside variables. variables contain things called objects like strings, integers or floating numbers or any sort of input. For example, Greeting = input("What's up?") here, 'Greeting' is the variable and it contains the string the user responds with to the question "What's up?"
Another example, Greeting = "Welcome to Palm City Beach!" here, 'Greeting' is still the variable but it contains a different value. Instead of an input, it contains a string.
Btw, strings are just alphanumeric characters and r always enclosed in quotation marks.
For example, firstName = input("what is your first name?") print( "Hi my name is", firstName)
in the function print, the string is "Hi my name is" and 'firstName' is the variable.
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsYou might say that object properties are "variables inside of other variables". For example, "name" and "age" are both inside "person":
var name = "Joe";
var age = 22;
var person = { name, age };
console.log("The person's name is " + person.name);
console.log("and they are " + person["age"] + " years old.");
But I'm not sure that was the original question since I don't see how it would relate to this video.
Ankush Sharma
844 PointsAnkush Sharma
844 PointsHe is asking about reassigning the variables.Can you please explain on that?