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 trial

JavaScript JavaScript Basics (Retired) Working With Numbers Using Math Methods

this is the alert method and it's not working

this is the alert method and it keeps asking if i'm using it.

script.js
var temperature = Math.round(37.5);
index.html
<!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
Adam Beer
11,314 Points

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.

i've tried that adam. var temperature=Math.round(temperature) it's not working

Adam Beer
Adam Beer
11,314 Points

Yes, 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.

I've tried that. It's not working

Adam Beer
Adam Beer
11,314 Points

I 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
Adam Beer
11,314 Points

This is working for me well.

I thought I had. I will try it again. I really appreciate your help.

My exact code is
var temperature=Math.round(37.5); alert (temperature);

Adam Beer
Adam Beer
11,314 Points

Yes! 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);

you were right. it worked. my eyes are crossing. thank you