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 trialhakan Gülay
8,489 Pointscouldnt solve
http://teamtreehouse.com/library/null-and-undefined-2
ı really couldnt solve this question actually ı couldnt understand can you plase tell me answer ? then ı can learn something from answer
2 Answers
J Scott Erickson
11,883 PointsThink of it this way, both null
and undefined
are falsey values. Which when being compared using ==
appear to be the same ( in javascript ).
However, using the ===
comparison goes deeper, and not only compares the two as falsey values, but checks to see if they are of the same type. If they are not, then it will evaluate false. And would go down the other control direction in the if clause, of skip if there is no other place to go.
hakan Gülay
8,489 Pointsit was too easy . how ı couldnt get it :)) thank you so much ı need to practise more ^^
J Scott Erickson
11,883 PointsIts all in the practice ;-) === is a javascript and php ( there are likely more languages that I can't think of ) quirk.
J Scott Erickson
11,883 PointsJ Scott Erickson
11,883 Points*compares not campsites, iphone spelling error :-p
James Barnett
39,199 PointsJames Barnett
39,199 PointsThe technical term for JavaScript "considering 2 values to the same" is called type coercion