5 Surprising JavaScript Facts for Developers

🚀 Day 88 of My #100DaysOfCode Challenge I thought I knew JavaScript… until I found these 🤯 Today I came across some weird (but real) JavaScript facts that honestly surprised me. Sharing here because I know I’m not the only one who didn’t know this 👇 💡 Things JavaScript does that feel illegal 😅 1️⃣ NaN is not equal to itself console.log(NaN === NaN); // false Yes… even JavaScript is confused here. 2️⃣ typeof null = "object" console.log(typeof null); // "object" This is actually a bug… and it still exists. 3️⃣ Functions can behave like objects function demo() {} demo.x = 10; console.log(demo.x); // 10 I didn’t expect this at all. 4️⃣ This looks correct but it’s not console.log(15 > 10 > 5); // false JavaScript evaluates it step by step… not the way we think. 5️⃣ [] + [] = "" console.log([] + []); // "" This one really broke my brain. JavaScript is not just a language… it’s full of surprises 😄 The more I learn, the more I realize how many small things we usually ignore — but they actually matter a lot. If you knew all of these already… respect 🙌 If not, welcome to the club 🤝 #Day88 #100DaysOfCode #JavaScript #CodingJourney #WebDevelopment #LearningInPublic

  • graphical user interface

To view or add a comment, sign in

Explore content categories