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 trial

JavaScript JavaScript and the DOM (Retiring) Making Changes to the DOM Styling Elements

Why does Guil use two = sign instead of 3

Why?

1 Answer

Jason Hill
seal-mask
.a{fill-rule:evenodd;}techdegree
Jason Hill
Full Stack JavaScript Techdegree Student 11,399 Points

So the difference is the == is 'loose' equality, and the ===is STRICT. The === will check that the type and the value compared are the same, while ==will try to convert two types then compare.
ex: true === true is true, 77 === 77 is true however 77 === '77' is false, because '77' is a string. While 77 == '77'will be true, even though one is a string as well as false == 0, will be true. It is called type coercion. Checkout MDN for more info! If this helps you can select it as best answer.

Andrew Hickman
seal-mask
.a{fill-rule:evenodd;}techdegree
Andrew Hickman
Full Stack JavaScript Techdegree Student 2,281 Points

Yes. A good rule of thumb is to ALWAYS use ===, just like it is always good to write a "use strict" statement at the top of your files. It basically forces you to write good code.