DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Discussion on: JavaScript Struggles - Part 2 | Numbers

Collapse
lukeshiru profile image
Luke Shiru

I did read it carefully, it is still wrong. If you add 1 to null, null being falsy when casted to number returns 0, so adding 1 obviously returns 1.

You might want to consider actually learning about how types work in JS before "explaining it" πŸ˜‘

Thread Thread
abdelrahman_dwedar profile image
β€˜AbdelraαΈ₯man Dwedar πŸ‘¨πŸ»β€πŸ’»πŸ‡΅πŸ‡Έ Author

I didn't mean that null is number buddy. and I just added null not because it's a number, it was because people think it's equal to 0 and then get confused when it doesn't equal.

And thanks for clarifying those topics that I didn't cover.