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 Basics (Retired) Working With Numbers Storing Numbers in Variables

Arvind Kevin Arjun Sharma
Arvind Kevin Arjun Sharma
8,272 Points

Add a second variable named price and store a floating point value (a number with a decimal) in it.

i don't really know what to do, who can help me to pass this so i will know it for the next time...???

var age = 20;

Price = 9.99;
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="script.js"></script>

2 Answers

Hi Arvind,

You are very close with your code! You should make sure to use the var keyword each time you initialize a variable so that it goes into the proper scope. And you will need to use a lower case price for the challenge because that's what it asks you to use although "Price" is a valid variable name. So, just attach the var keyword and put the capital p in price to lowercase like so:

var price = 9.99;

Another way to get through this challenge is to put price on the same line as age. All you have to do is separate each variable and its data by a comma like so:

var age = 20, price = 9.99;

You're welcome, Arvind! Happy Coding :)