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!
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
Eric TiradoiOS Development Techdegree Student 7,036 Points
when I type undefined = true; I still get a true value on my console in google chrome.
console.log(myVar === undefined); doesn't print a false value when I type undefined = true. Why is this?
When I read that undefined is not a writable property, it made things crystal clear (as far as how to use undefined). It fits in with what Katie stated "typing undefined = true would be ignored". Further testing has reinforced my understanding. This portion of the lesson should be redone.
Hope that helps.
UPDATE: On the MDN site, I did see an example of how undefined COULD be changed. Maybe it is something the TreeHouse team can clarify as it relates to this video and lesson.
Kate Hoferkamp5,205 Points
I'm not positive what you are trying to do either, but you cannot set undefined to be anything, ie true. Undefined is a state not a variable. So typing undefined = true would be ignored.
I'm not sure what you're trying to do, but I'm pretty sure you're going about it the wrong way. Are you trying to test if a variable is undefined? If so, this would be the way to do it:
var myVar; console.log(myVar);