typeof null in JavaScript
❓ Question:
Run this: typeof null — what do you think it returns?
One of the oldest and trickiest quirks in JavaScript.
Can you guess it without googling?
💬 Comment your answer below 👇
📌 Subscribe for daily JavaScript traps & logic boosts: / @frontendgurus
#Shorts #JavaScript #typeofNull #JSQuiz #CodingQuiz #FrontendDev #WebDevelopment #JSFacts #LearnJavaScript #CodeChallenge #dailycoding #viralvideo #video
#CodeTrivia #ProgrammerLife #JSQuirks #JSShorts #Shorts #DevShorts #TechShorts #JavaScriptFacts #JavaScriptTips #TypeofOperator
#CodeShorts #ProgrammingShorts #CodeSnippet #FrontendTips #DeveloperHumor #CodeLife #Debugging #TechChallenge #100DaysOfCode
#WebDev #JavaScriptDaily #ProgrammerMindset #TypeCoercion #JSOperators #JSInterviewPrep #LearnToCode #JavaScriptTricks
#FullStackDev #FrontendDeveloper #BitwiseMagic #ProgrammerQuiz #JavaScriptLearners #CodingLife #ModernJavaScript #JSProblems
#TechTok #DevTok #NullInJS #JSFundamentals #CodeSmart #JSTrivia
🧠Explanation:
This behavior is actually a long-standing bug in JavaScript.
In the early versions of JavaScript, values were stored using a type tag system. The tag for objects was 0, and unfortunately, null was also given the same tag — so typeof null returned "object".
This was never fixed to avoid breaking existing code, so it’s still around today.
✅ What to remember:
null is a primitive, not an object.
typeof null returns "object" — it's a known quirk in JavaScript.
To properly check for null,
コメント