DEV Community

Discussion on: JavaScript is bananas

icecoffee profile image
atulit023 • Edited

Earlier I was trying to make an error and I got

drochetti profile image
Daniel Rochetti Author

haha yep, same root cause. The object gets converted to a string, "[object Object]" and then appended to the number, which is also converted to a string.

Long story short, when JS doesn't know what to do, it converts everything to a string and call it a day.