for-coder
438 subscribers
99 photos
52 videos
23 files
136 links
Download Telegram
🚨 JAVASCRIPT HAS A REAL BUG! 🚨


Open your console and type:
typeof null


You'll get:
'object'


That's wrong—null is not an object!

🔍 How did this happen?

When JavaScript was first implemented, values were stored in a tagged format, where the lower bits determined the type:
- Objects had a type tag of 0.
- null was stored as 0 in memory.

Since null had 0 in its type tag, typeof mistakenly classified it as an "object".

🔧 Why isn't it fixed?
One word: Backward compatibility.
Fixing it would break too many apps, so it's here to stay!

💬 Share this with JavaScript haters new (Lovers)... Lmao

#JavaScript #Bug #Programming