JavaScript Core Concepts: Primitive Types, Truthy/Falsy, Null/Undefined, Equality, Scope

🚀 Day 22/100 – #100DaysOfCode JavaScript Interview Questions (Core Concepts) Revised some fundamental JavaScript interview questions that every developer is expected to understand clearly. 🔹 Primitive vs Non-Primitive Data Types -Primitive: Stored by value (Number, String, Boolean, Null, Undefined, Symbol, BigInt) -Non-Primitive: Stored by reference (Object, Array, Function) Primitive types are immutable, while non-primitives are mutable. 🔹 Truthy vs Falsy Values -Falsy values: false, 0, "", null, undefined, NaN -Truthy values: Everything else (e.g., "hello", 1, [], {}) Used heavily in conditions like if statements. 🔹 null vs undefined undefined: A variable is declared but not assigned a value null: Intentionally assigned empty value undefined = default, null = intentional absence 🔹 == vs === (Double vs Triple Equal) == → Compares value only (type coercion happens) === → Compares value and type (strict comparison) Always prefer === to avoid unexpected bugs. 🔹 Scope in JavaScript Scope determines where variables are accessible: -Global Scope → Accessible everywhere -Function Scope → Accessible inside functions -Block Scope → Accessible inside {} (let, const) Understanding scope is critical for avoiding bugs and writing predictable code. 22 days down, 78 more to go. #Day22 #100DaysOfCode #JavaScript #FrontendDevelopment #WebDevelopment #CodingInterview

To view or add a comment, sign in

Explore content categories