These are chat archives for MontCode/GeneralChat

23rd
Mar 2017
Bryon Martinez
@brindlebrew
Mar 23 2017 01:52
Quick JS question. Does anyone use equality (==) in place of strict equality (===). When I was working in the Flatiron program they only taught the strict equality version. So I am trying to understand where I would use each case and not just stick to a strict equality in my code.
Michael Perry
@keepsabbathholy_twitter
Mar 23 2017 11:28
There's no real reason to use == in place of ===
It's put in place to make sure that JS doesn't type convert during comparison
Bryon Martinez
@brindlebrew
Mar 23 2017 16:11
Ok thanks @mclark610 . That was what they explained (I am still not sure how or why it would type convert). I will ensure I continue to use === when working!
MontBot
@MontBot
Mar 23 2017 16:11
brindlebrew sends cookie points to @mclark610 :sparkles: :thumbsup: :sparkles:
:cookie: 3 | @mclark610 |http://www.freecodecamp.com/mclark610
Michael Perry
@keepsabbathholy_twitter
Mar 23 2017 20:11
@brindlebrew Type conversion is built into JS by default. Say you had the line ("5" == 5) - even though this value is not logically equivalent, JS will do everything in its power to make the statement "truthy" by type converting, so instead of getting "false", you'll now get "true". Many programmers consider this to be dangerous behavior and that's why they use (===), which not only checks to see if the values in the comparison are equal, but also checks to see if their types are equal.
Bryon Martinez
@brindlebrew
Mar 23 2017 20:15
Ahhh that makes a lot more sense. I didn't realize it was built in. Thanks!
Lily Romano
@Lilyheart
Mar 23 2017 20:51
awesome way to explain it. thanks @keepsabbathholy_twitter
MontBot
@MontBot
Mar 23 2017 20:51
lilyheart sends cookie points to @keepsabbathholy_twitter :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for keepsabbathholy_twitter
Lily Romano
@Lilyheart
Mar 23 2017 20:52
Any fun coding plans for tonight?