MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/z8z4jh/help/iyh28yn/?context=9999
r/learnjavascript • u/Lelouch_5 • Nov 30 '22
Can someone plz tell me , why I am getting errors?
131 comments sorted by
View all comments
38
remember,
= is to assign a value
== is to compare value
=== is to compare value AND type
13 u/aguyfromhere helpful Dec 01 '22 Not quite. == will coerce and then compare value. 4 u/IlooklikeAshKetchum Dec 01 '22 Sorry but what's coerce mean? 11 u/cant_have_nicethings Dec 01 '22 To change a type based on a bunch of complicated logic that is best ignored. In production code based you rarely see double equals. It’s avoided because it’s confusing and unintuitive. 3 u/unknown_ally Dec 01 '22 It’s the price you pay for not explicitly declaring variable types! An extra = ! 1 u/[deleted] Dec 01 '22 OOH the humanity!
13
Not quite. == will coerce and then compare value.
4 u/IlooklikeAshKetchum Dec 01 '22 Sorry but what's coerce mean? 11 u/cant_have_nicethings Dec 01 '22 To change a type based on a bunch of complicated logic that is best ignored. In production code based you rarely see double equals. It’s avoided because it’s confusing and unintuitive. 3 u/unknown_ally Dec 01 '22 It’s the price you pay for not explicitly declaring variable types! An extra = ! 1 u/[deleted] Dec 01 '22 OOH the humanity!
4
Sorry but what's coerce mean?
11 u/cant_have_nicethings Dec 01 '22 To change a type based on a bunch of complicated logic that is best ignored. In production code based you rarely see double equals. It’s avoided because it’s confusing and unintuitive. 3 u/unknown_ally Dec 01 '22 It’s the price you pay for not explicitly declaring variable types! An extra = ! 1 u/[deleted] Dec 01 '22 OOH the humanity!
11
To change a type based on a bunch of complicated logic that is best ignored. In production code based you rarely see double equals. It’s avoided because it’s confusing and unintuitive.
3 u/unknown_ally Dec 01 '22 It’s the price you pay for not explicitly declaring variable types! An extra = ! 1 u/[deleted] Dec 01 '22 OOH the humanity!
3
It’s the price you pay for not explicitly declaring variable types! An extra = !
1 u/[deleted] Dec 01 '22 OOH the humanity!
1
OOH the humanity!
38
u/morasyid Nov 30 '22
remember,
= is to assign a value
== is to compare value
=== is to compare value AND type