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 trialPaul Trimor
5,388 PointsIt seems that even if I change the value of "undefined", it still reads true.
This is the Javascript code.
var myVar;
undefined = true;
console.log( typeof myVar === "undefined");
console.log( myVar === undefined);
This is what prints in the console.
true
true
However, on the video, it prints true false.
2 Answers
Dino Paškvan
Courses Plus Student 44,108 PointsThe ECMAScript 5 standard of JavaScript (the currently widely used standard) defines undefined
as an immutable property. This basically means that you can't change its value anymore.
When this video was recorded, Chrome was using the ECMAScript 3 standard where undefined
was mutable. That's why your browser prints out true true
. In your browser, you can't change undefined
's value. In the old one, you could do that.
Darren Kynaston
Courses Plus Student 15,610 PointsHi Paul,
Whats the question or at what point (time) in the video are you looking at?