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) Making Decisions with Conditional Statements Using Comparison Operators

this code challenge might be glitchy, I am watching "a is not greater than b" popup in the JS window but I get error

this code challenge might be glitchy, I am watching "a is not greater than b" pop up in the JS window but I get an error saying it cannot find the alert that says "a is NOT greater than b". HELP!

script.js
var a = 10;
var b = 20;
var c = 30;
if (a > b) {
  alert('<p>a is greater than b</p>');
} else {
  alert('<p>a is NOT greater than b</p>');
}
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>
Julie Myers
Julie Myers
7,627 Points

Your coding works. Where are you getting the error message at? When you run the code in workspace or the JS console in your browser?

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Chad,

You are getting the error because you are adding HTML p tags into the JavaScript code that was not asked for by the challenge and is not needed.

Just delete those, and you're good to go.

if (a > b) {
  alert('a is greater than b');
} else {
  alert('a is NOT greater than b');
}

Keep Coding! :)

Thanks Abunch! I'm glad I had the ability to skip the challenge and continue to code :)!