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.

sean farrelly
1,614 Pointsadd a conditional statement that tests if the value in variable a is greater than the variable b. if it is a pop up aler
add a conditional statement that test if the value in variable a is greater than the variable b. if it is a pop up alert with message a is greater than b. also add is greater else clause that pops up the message a is not greater than b.
var a = 10;
var b = 20;
var c = 30;
if (" answer === " var a" > " var b ") {
windows.alert ("var a is greater than var b") ;
} else {
windows.alert ( " var a is not greater than var b");
}
<!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>
2 Answers

Steven Parker
220,352 PointsFirst off, your conditional statement looks like you're trying to format a string for printing ... but to actually compare two variables you only need their names and the comparison operator. In this case
(a > b)
Then, when you print your alerts, your strings are a bit different than what the challenge asked. They need to be exactly the same for the checking routine to recognize them.
And finally, you wrote "windows" (with an extra "s") instead of "window" when calling the alert. You can fix it, but if you want you can also remove it entirely since the properties and methods of the window object are accessible just by name.

Rogier Nitschelm
iOS Development Techdegree Student 5,461 PointsGreat explanation by Steven Parker.
Removed as I guess this isnt a fitting response

Steven Parker
220,352 PointsWhile that code may get a "pass" from the checking routine, that's actually not what the challenge asks for, for some of the reasons I discussed in my hints. The solution based on the instructions is actually a bit simpler (hint: no concatenation is needed).
Plus I think most folks get a better learning experience arriving at the final code themselves instead of plugging in explicit code solutions.
But your desire to help is great. Please take my comments merely as suggestions.