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 trialmaya sophie
5,754 PointsHow can I make 213.38( profit ) to appear like h2 ? I tried only <h2>profit</h2> but nothing is displayed.
To be more clear: I want to see the 213.38 like an h2 without having to use '<h2>The number is ' + profit + ' !</h2>'.I hope I was understandable, thx
var wholesalePrice = 5.45;
var retailPrice = 9.99;
var quantity = 47;
var salesTotal = 9.99 * 47;
var profit = salesTotal - (5.45 * 47);
document.write('<h2>The number is ' + profit + ' !</h2>)';
<!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
KRIS NIKOLAISEN
54,971 PointsIf you run this through the console you'll see you are missing a closing parenthesis on line 6 of your script
document.write('<h2>The number is ' + profit + ' !</h2>)';
should be
document.write('<h2>The number is ' + profit + ' !</h2>');
Your closing parenthesis needs to be outside the final quote.
maya sophie
5,754 Pointswell...I changed it but it didn't update...but this is not what I meant to know...after making the code correct, I want to see the 213.38 like an h2 without having to use '<h2>The number is ' + profit + ' !</h2>'.I hope I was understandable, thx