Hmmm, I'd say stuff like.
String + number = concatenated number or string
String - number = number or NaN
I've spent some time debugging an issue related to this and only found it a few years ago. Wish they had a class like 'JS - Fun facts'.
yup! Great idea for some tricky examples and exercises! :D
Type coercion, if anyone is curious about the topic.
The famous example:
'10' + 1 === '101' '10' - 1 === 9
:-)
(and the difference between == and === that's also a nice one)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hmmm, I'd say stuff like.
String + number = concatenated number or string
String - number = number or NaN
I've spent some time debugging an issue related to this and only found it a few years ago. Wish they had a class like 'JS - Fun facts'.
yup! Great idea for some tricky examples and exercises! :D
Type coercion, if anyone is curious about the topic.
The famous example:
'10' + 1 === '101'
'10' - 1 === 9
:-)
(and the difference between == and === that's also a nice one)