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 trialKeyanna Owens
3,498 PointsI have a problem with the first question involving math methods in the javascript basics course.
I have to use the alert() function, but when i did i get an error message that says variable alert is undefined. This is the code i used: var temperature = Math.round(37.5); Alert(temperature);
I'm not sure where i went wrong.
var temperature = Math.round(37.5);
Alert(temperature);
<!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>
1 Answer
Steven Parker
231,275 PointsIt's a typo or misspelling.
JavaScript is case sensitive, and instead of the function name "alert" (with a lower-case "a"), you wrote "Alert" (with a capital "A").
Keyanna Owens
3,498 PointsKeyanna Owens
3,498 PointsOh wow, you're right! I can't believe that was what was wrong with it. HAHAHA! Thank you for helping me.