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 trialSergio Lopez
271 PointsWhat does it mean
Triple equals "equals equals equals"
AND
"typeof"
??
2 Answers
Dave McFarland
Treehouse TeacherHere are a few examples:
5=='5'; // is true because javascript treats them as same type of object
5==='5'; // is false because 5 is a number and '5' is a string (different types so not equal
console.log(typeof 'name'); // prints 'string'
console.log(typeof 5); // prints 'number'
console.log(typeof true); // prints 'boolean'
Adam Sackfield
Courses Plus Student 19,663 PointsThe === (triple equal sign) is the identity operator and the == (double equal sign) is the equality operator and they are the same except on the identity operator it will not convert types to the same ie 5 and "5" whereas the equality operator will convert the first 5 to a string to match the second "5".
AND is for use in an IF something AND somethingelse are true do this.
typeof is used for checing the type of an object or variable ie string, number
Adam Sackfield
Courses Plus Student 19,663 PointsAdam Sackfield
Courses Plus Student 19,663 PointsAs a sidenot Google would have told you these with relative ease