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 trialArvind Kevin Arjun Sharma
8,272 PointsAdd 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;
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
2 Answers
Marcus Parsons
15,719 PointsHi 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;
Arvind Kevin Arjun Sharma
8,272 PointsThank you Marcus!
Marcus Parsons
15,719 PointsYou're welcome, Arvind! Happy Coding :)
Marcus Parsons
15,719 PointsMarcus Parsons
15,719 PointsAnother way to get through this challenge is to put
price
on the same line asage
. All you have to do is separate each variable and its data by a comma like so:var age = 20, price = 9.99;