Variable not equal to anything


#1

"Create a variable named notDefined, but don’t set it equal to anything.

Log the result to the console."

I have tried this every way I can think of, and it doesn’t work. Here’s an example of one of my attempts:

var notDefined =("") ;
console.log(“notDefined”);

I’m sure it is something simple, but I am not seeing it.

Thanks!

–Will.


#2

Ok, I found a solution:

var notDefined = undefined ;
console.log(“notDefined”);

If you have another solution, let me know.


#3

here’s what I do:
let var;
console.log(var)

Just make sure you put in the real variable not var!
I hope it works for you! :+1:


#4

In this case I think they want the variable to be undefined, so I couldn’t make it quite that simple.

This is as simple as I could get it and get the “pass/green check mark” :

notDefined = undefined;
console.log(notDefined);

–Will.


#6

I just realized your problem. You are trying to assign notDefined the value of undefined. undefined means you didn’t assign it any value.
Put in: let notDefined;
console.log(notDefined)
let notDefined; will be like saying: notDefined means blank to me. You don’t GIVE notDefined the word undefined, you have to leave it at literally no defined value.
Quick question. Did you try my way?


#7

Yes, and I thank for you answer, it was helpful. I had to tweek it a little bit, but that is to be expected.

–Will.


#8

Okay, I’m glad it worked out! :smile:


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.