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 trialKim Dallas
11,461 Pointsthis is the alert method and it's not working
this is the alert method and it keeps asking if i'm using it.
var temperature = Math.round(37.5);
<!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>
6 Answers
Adam Beer
11,314 PointsThis is just a variable where you store the value. Now you store the rounded number value inside the variable. Write below the variable an alert() dialog, and put inside the variable name.
Kim Dallas
11,461 Pointsi've tried that adam. var temperature=Math.round(temperature) it's not working
Adam Beer
11,314 PointsYes, because This is just a variable where you store the value. Now you store the rounded number value inside the variable. Write below the variable an alert() dialog, and put inside the variable name.
On line 2 write an alert() dialog, and put inside to the variable name. Now the variable name equal to temperature.
Adam Beer
11,314 PointsVariable: JavaScript Variables
alert() dialog: Window alert() Method
Kim Dallas
11,461 PointsI've tried that. It's not working
Adam Beer
11,314 PointsI don't think so.
Your frist line -> var temperature = Math.round(37.5);
Your second line -> alert() with your variable name?
Please share me what your code looks like.
Adam Beer
11,314 PointsThis is working for me well.
Kim Dallas
11,461 PointsI thought I had. I will try it again. I really appreciate your help.
Kim Dallas
11,461 PointsMy exact code is
var temperature=Math.round(37.5); alert (temperature);
Adam Beer
11,314 PointsYes! That's it! This is the good code for task 1 :) Just write in a new line, like this:
var temperature = Math.round(37.5);
alert(temperature);
Kim Dallas
11,461 Pointsyou were right. it worked. my eyes are crossing. thank you