Learning JavaScript Fundamentals with Module 27

Day 1 #100DaysOfCode 💻 Today I learned important JavaScript fundamentals from Module 27. 1. Primitive vs Non-Primitive Data Types Primitive stores actual value (number, string, boolean). Non-primitive (object, array) stores reference. let x = 10; let arr = [1, 2, 3]; 2. Truthy & Falsy Values Falsy values: false, 0, "", null, undefined, NaN. Everything else is truthy. if ("Hello") { console.log("Truthy"); } 3. null vs undefined undefined = declared but not assigned. null = intentionally empty. let a; let b = null; 4. == vs === == checks value (type converts). === checks value + type. console.log(5 == "5"); // true console.log(5 === "5"); // false 5. Scope (Global, Function, Block) Scope defines where variables are accessible. let globalVar = "Hi"; function test() { let localVar = "Hello"; } 6. Hoisting Declarations move to the top before execution. console.log(num); var num = 5; 7. Closure Inner function remembers outer function variables. function outer() { let count = 0; return function () { count++; }; } 8. Pass by Value vs Reference Primitive copies value. Objects copy reference. let a1 = 5; let b1 = a1; let obj1 = { name: "John" }; let obj2 = obj1; 9. Unary Operators (++ / --) Increase or decrease value by 1. let n = 5; n++; This module strengthened my core understanding of how JavaScript works behind the scenes. Building strong fundamentals step by step. #100DaysOfCode #JavaScript #WebDevelopment #FrontendDeveloper #Akbiplob

To view or add a comment, sign in

Explore content categories