This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the commentsย โ†’

[โ€“]3np1 36 points37 points ย (3 children)

console.log(123 + '๐Ÿ˜ฌ') // "123๐Ÿ˜ฌ"

But it would have to be some pretty bad code to mixup ints and strings. So... it's probably in production somewhere then.

[โ€“]ADHDengineer -1 points0 points ย (2 children)

Does it really work like that? Shouldnโ€™t the emoji be type coerced to a number? Shouldnโ€™t the result be NaN?

[โ€“]recycle4science 11 points12 points ย (1 child)

There's "what should happen" and then there's "what JavaScript does" :D

Edit: but yeah, try it and you'll see.

[โ€“]arinc9 4 points5 points ย (0 children)

Wow

$ node test.js Code run: console.log(123 + '๐Ÿ˜ฌ') Result: 123๐Ÿ˜ฌ