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 trialEric Vandenberg
9,095 PointsHelp new to Javascript
''' <!DOCTYPE html> <html lang="en"> <head> <title> JavaScript Foundations: Variables</title> <style> html { background: #FAFAFA; font-family: sans-serif; } </style> <script src="ignore_this.js"></script> </head> <body> <h1>JavaScript Foundations</h1> <h2>Variables: Null and Undefined</h2>
<div id="container">
</div>
<script>
var myUndefinedVariable;
var myNullVariable = null;
if(myNullVariable == myUndefinedVariable) {
identical();
}
</script>
</body> </html> '''
Im being asked to fix the code where identical();
I know I'm supposed to use strict equality using === but not sure how
please help, thanks!
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Eric,
What the challenge is telling you is that with ==
the if
condition is true and the identical()
function is being called but those two variables are not identical. So you have to update the if
condition to use ===
instead so that the if
condition will be false and the identical() function won't be called.
Eric Vandenberg
9,095 PointsThanks Jason!