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

temperature challenge "What am I doing wrong?"

I tried putting the Math.round next to and below the alert

script.js
var temperature = 37.5;
alert('temperature');
Math.round('temperature');
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>

So I figured it out, that I was using Strings. I got confused by this because in the previous video it used the code alert('Can you hear me;?).toUpperCase));

If someone could explain why strings don't work here that would be great.

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,857 Points

Hey Frank,

To the interpreter, a string is just a 'sting of characters that have no meaning'. Now the name of the variable is important and has meaning to the interpreter. So, when you surround the name of a variable with quotes, it gets turned into a string and has no meaning other than being a string. Without quotes, the interpreter knows it's the name of a variable and goes and gets the data from the variable to use in the code.

Make sense?

:) :dizzy: