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 trialShadrach Thomas
Courses Plus Student 8,915 Pointsi need help on this challenge
i don't know what i'm doing wrong here
var width = '190px';
var numOfDivs = 10;
var totalWidth = "parseFloat'('190px') + 'parseInt'('10');
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script src="app.js"></script>
</body>
</html>
4 Answers
Steven Parker
231,269 PointsHere's some hints:
- never put quotes around a function name or a variable name
- there aren't any float values in this challenge
- only the width value is a string and will need conversion
- be sure to use the variables (by name) instead of repeating their literal values
- the challenge said the formula multiplies the values (not adds)
Shadrach Thomas
Courses Plus Student 8,915 PointsI'm sorry i still don't understand
Steven Parker
231,269 PointsDo you understand any of the hints? Use the ones that make sense to you to make changes to your code, and then show what the changed code looks like.
Shadrach Thomas
Courses Plus Student 8,915 Pointsstill yet it's not going through
Steven Parker
231,269 PointsWhat's your code look like after all the changes?
Shadrach Thomas
Courses Plus Student 8,915 Pointsvar width = '190px'; var numOfDivs = 10; var totalWidth = 'parseFloat'('190px')') + 'parseInt'('10');
Steven Parker
231,269 PointsThat looks the same, except you added one more quote and one more parenthesis. Did you read the hints I gave?
Shadrach Thomas
Courses Plus Student 8,915 Pointsplease i'm sorry to bother you var width = '190px'; var numOfDivs = 10; var totalWidth = (parseInt('190px') * (numofDivs);
Steven Parker
231,269 PointsClose, but you should use the width variable, and spell numOfDivs with a capital "O":
var totalWidth = parseInt(width) * numOfDivs;
elsie bogaert
4,335 Pointselsie bogaert
4,335 PointsYou're using a quotation mark ( " ) on one end and on the other end you're using an apostrophe ( ' ) could that be the issue?