Skip to main content

Type coercion confusion in JavaScript

Updated 1 min readMarkdown

Today I learned this is not true in JavaScript, and I'm shocked 🤯

"true" == true //returns false

— James Q Quick (@jamesqquick) June 13, 2022

My answer

Yes, when you allow coercion with == you get NaN is not equal to 1.

That is what the spec says.https://t.co/c2rEghMaTq

— Ivan Bunčić 🦄🥑⌨ (@ivanbuncic) June 14, 2022

When you are in doubt, read the Spec please.

About the author

  • 𝙵𝚞𝚕𝚕 𝚂𝚝𝚊𝚌𝚔 𝙲𝚘𝚙𝚢 𝙿𝚊𝚜𝚝𝚎𝚛 ™ | Started in 1984 with LOAD '''' ENTER & PLAY.

No comments yet. Be the first to comment.