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

JavaScript JavaScript Quickstart Data Types and Variables Creating Variables

How do you create a new variable?

I have typed in var = 'myage' to create a new variable and then add a string with var response = '43' but keep getting an error message

scripts.js
var = 'myAge'
var response = '43'

2 Answers

Edgardo Serafin
seal-mask
.a{fill-rule:evenodd;}techdegree
Edgardo Serafin
Full Stack JavaScript Techdegree Student 11,880 Points

You are close, the only thing is that you split it into two variables when if you combine them, you'll have the correct answer

you have the ability to name your variables, so an example would be

var fruit = 'apple';

now keep this in mind for your name

I think the conceptual issue here is fully understanding a string and what makes it a string..

The big concept of a string is that you surround it with '' or "" to create the string, and strings can be STORED in a variable. Think of the variable as a box, and in that box you can store things like strings, numbers, booleans, etc....

So should a variable be a string? Or is a variable something different? As of right now, you are assigning your variable to be a string.

I hope this helps steer you in the correct direction! :) Happy coding!

if myAge is what you want your variable to be. The response should be what you store in variable myAge

example: var variableName = 'random string you would like to store in the variable named variableName'

console.log(variableName);

output: random string you would like to store in the variable named variableName