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 trialIsrael Briggs
1,652 PointsNull and Undefined video instructions are not relaying current functionality
I understand that code changes, but are there plans to update this video at some point? It was a bit frustrating, but learning experience, to hunt down why I wasn't seeing the same thing despite having the exact same code :P
1 Answer
Jim Withington
12,025 PointsJason Anello : well, when I ran this code in the console, it actually gave me two true results, even though the video says it would return true / false.
var myVar;
undefined = true;
console.log(typeof myVar === "undefined");
console.log(myVar === undefined);
Jason Anello
Courses Plus Student 94,610 PointsHi Jim,
According to this mdn page: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined as of ecmascript 5 the undefined
property is no longer writable.
My best guess is that at the time of recording this video, Jim's browser was using an older version of the standard which did allow you to change the value of undefined
Now it's no longer possible and so that line undefined = true
is essentially ignored.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi Israel,
What wasn't the same?