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 Foundations Variables Null and Undefined

I keep getting an 'Oh no' warning on the Javascript identical() task, everytime i submit. Why is this?

I entered my fix in the code section, and clicked submit, but i get no progress or wrong confirmation. Instead i keep getting a pop up warning that something is wrong.

<!DOCTYPE html>
<html lang="en">
    <title> JavaScript Foundations: Variables</title>
      html {
        background: #FAFAFA;
        font-family: sans-serif;
    <script src="ignore_this.js"></script>
    <h1>JavaScript Foundations</h1>
    <h2>Variables: Null and Undefined</h2>

    <div id="container">


        var myUndefinedVariable = null;
        var myNullVariable = null;

        if(myNullVariable == myUndefinedVariable) {


1 Answer

Clayton Perszyk
Clayton Perszyk
Treehouse Moderator 48,837 Points

Change this:

var myUndefinedVariable = null;


var myUndefinedVariable;  // this variable is now undefined

In your condition, you need to use the 'strict equality' operator (===):

if (myNullVariable === myUndefinedVariable) {

Because both null and undefined are falsey values the double equality operator (==) returns true; the triple equality operator (===) will check to see if the two values are identical, and in the case of null and undefined they are not 'strictly' the same value, even though they are both falsey.

Appreciate the help Clayton. Is it normal for the website to pop up the 'Oh no' dialog when the solution is wrong? I thought it would just show the red banner (it never showed red or green banners, looked like stuck)?

Clayton Perszyk
Clayton Perszyk
Treehouse Moderator 48,837 Points

When you get the popup, 'Oh no', it doesn't have anything to do with your answer. It just means your request isn't going through. Sometimes closing your browser (or maybe refreshing it) and then reopening it will help; sometimes it's better to try the challenge later. Not sure exactly why it happens, but it isn't indicative of failing code; rely on the green and red banners for whether or not your code is passing.