Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,704 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: