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 trialameshuffle
8,966 PointsParseInt coding problem
A little help here. Am I missing something?
<!DOCTYPE html>
<html lang="en">
<head>
<title>JavaScript Foundations: Parsing Numbers From Strings</title>
<link rel="stylesheet" href="core.css">
<script>
var boxWidth = "640px";
var boxHeight = "480px";
var numWidth = parseInt("640", 10);
</script>
</head>
<body>
<h1>JavaScript Foundations</h1>
<h2>Parsing Numbers From Strings</h2>
<script src="viewer.js"></script>
</body>
</html>
10 is supposed to be the base decimal right?
I read on the Teacher's Note that newer browsers state 12 instead of 10 so I don't know.
2 Answers
Gabriel Otero
15,368 Pointspass in boxWidth variable to the first parameter of the parseInt() method.
ameshuffle
8,966 PointsSo basically it's this var numWidth = parseInt(boxWidth, 10);
Yep now I got it. Thanks.
Gabriel Otero
15,368 PointsAwesome! You're welcome!