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
Learning JavaScript Fundamentals with Module 27
More Relevant Posts
-
Today I learned something interesting about fetching data in JavaScript. When we use fetch(), many beginners notice that it usually has two .then() methods. At first it looks unnecessary, but there is a clear reason behind it. The first .then() handles the HTTP response returned by fetch(). The second .then() is used to convert that response into actual JSON data using response.json(). Example: fetch("API_URL") .then(response => response.json()) .then(data => { console.log(data); }); While revising this concept, I also learned a cleaner and more modern approach using async/await, which makes asynchronous code easier to read and understand. async function getData() { const response = await fetch("API_URL"); const data = await response.json(); console.log(data); } Both approaches work the same way internally using Promises, but async/await makes the flow feel more natural. Small concepts like these help in writing cleaner and more maintainable JavaScript code. #JavaScript #WebDevelopment #AsyncJavaScript #FetchAPI #CodingJourney #LearningInPublic
To view or add a comment, sign in
-
-
Just published another blog This time on Variables and Data Types in JavaScript. While revisiting the fundamentals, I realized how important it is to clearly understand how variables work and the different data types in JavaScript. These basics shape how we write and think about code. In this blog, I’ve tried to break things down in a simple and easy-to-understand way. If you’re starting out with JavaScript or brushing up your fundamentals, feel free to check it out: https://lnkd.in/d7zxdGMZ Open to feedback and suggestions 🙂 #JavaScript #WebDevelopment #LearningInPublic #BuildInPublic #ChaiCode
To view or add a comment, sign in
-
Just published a new blog on JavaScript Arrays 🚀 Arrays are one of the most commonly used data structures in JavaScript, but understanding how they actually work makes writing cleaner and more efficient code. In this post I covered: • How arrays are created in JavaScript • How they store and manage data • Basic operations developers use every day This article is part of my effort to revisit JavaScript fundamentals and document the learning along the way. If you're learning JavaScript or refreshing your basics, this might be helpful. #javascript #webdevelopment #programming #frontend #developers url - https://lnkd.in/d7kAfXpf Chai Aur Code Akash Kadlag Barun Tiwary @jay Hitesh Choudhary Piyush Garg
To view or add a comment, sign in
-
ICYMI: By processing millions of CSV rows directly in the browser, this tutorial shows how WebAssembly outpaces JavaScript when the data gets big. By Jessica Wachtel
To view or add a comment, sign in
-
🚀 JavaScript Day 2 – Deep Understanding of Core Concepts Today I focused on understanding each concept in detail with definitions and clarity 💻🔥 📌 Topics & Definitions: 🌐 Origin of JavaScript JavaScript was created in 1995 by Brendan Eich to make web pages interactive. 📝 Variables Declaration Variables are used to store data values using let, var, or const. 🔒 Constants Declaration Constants (const) store values that cannot be reassigned after declaration. ⚠️ Old Method: var var is the old way of declaring variables, function-scoped and can cause issues. ❌ Problems with var No block scope Can be redeclared Causes bugs due to hoisting 🔑 let vs const let → value can change const → value cannot change 📊 Data Types in JavaScript 👉 Primitive Data Types (Immutable) Number 🔢 → Stores numeric values String 🧵 → Stores text Boolean ✅❌ → true/false values Undefined ❓ → Variable declared but not assigned Null ⚪ → Intentional empty value BigInt 💡 → Large integers beyond Number limit Symbol 🔐 → Unique identifier 👉 Non-Primitive Data Types (Mutable) Array 📦 → Collection of values Object 🧱 → Key-value pairs Function ⚙️ → Reusable block of code 🧠 Important Concepts: 🔍 Null vs Undefined undefined → value not assigned null → intentionally empty ⚙️ typeof Operator Used to check data type of a value 🤯 typeof null Bug typeof null returns "object" (this is a known JavaScript bug) 🔒 Immutability (Primitive) Primitive values cannot be changed directly 🔄 Mutability (Non-Primitive) Objects & arrays can be modified 📥 Pass by Value Primitive values are copied when assigned 🔗 Pass by Reference Objects are assigned by reference (memory address) 💡 Why Pass by Reference? To save memory and improve performance 📅 Day 2 Complete ✔️ Building strong fundamentals step by step 💪 #JavaScript #LearningJourney #Day2 #Coding #WebDevelopment #Programming #Developer
To view or add a comment, sign in
-
-
💡 Pass by Value vs Pass by Reference in JavaScript (Simple Explanation) If you're learning JavaScript, understanding how data is passed is crucial 👇 🔹 Pass by Value (Primitives) When you assign or pass a primitive type (number, string, boolean, null, undefined, symbol, bigint), JavaScript creates a copy. let a = 10; let b = a; b = 20; console.log(a); // 10 console.log(b); // 20 👉 Changing b does NOT affect a because it's a copy. 🔹 Pass by Reference (Objects) When you work with objects, arrays, functions or date objects, JavaScript passes a reference (memory address). let obj1 = { name: "Ali" }; let obj2 = obj1; obj2.name = "Ahmed"; console.log(obj1.name); // Ahmed console.log(obj2.name); // Ahmed 👉 Changing obj2 ALSO affects obj1 because both point to the same object. 🔥 Key Takeaway Primitives → 📦 Copy (Independent) Objects → 🔗 Reference (Shared) 💭 Pro Tip To avoid accidental changes in objects, use: Spread operator {...obj} Object.assign() Understanding this concept can save you from hidden bugs in real-world applications 🚀 #JavaScript #WebDevelopment #Frontend #Programming #CodingTips
To view or add a comment, sign in
-
🌐 Learning Frontend Day 14: JavaScript Data Types JavaScript data types are the building blocks of all logic in web development. They define how values are stored, manipulated, and interpreted. 🔑 Key Data Types in JS: Primitive Types String → "Hello World" Number → 42, 3.14 Boolean → true / false Null → intentional empty value Undefined → variable declared but not assigned Symbol → unique identifiers BigInt → large integers beyond Number limits Non-Primitive (Reference) Types Object → collections of key-value pairs Array → ordered lists [1,2,3] Function → reusable blocks of code #FrontendDevelopment #JavaScript #WebDevelopment #LearningJourney #CodingLife #100DaysOfCode #TechSkills #DeveloperCommunity #JSBasics #CodeNewbie
To view or add a comment, sign in
-
-
𝗧𝗵𝗶𝘀 𝗜𝘀 𝗔 𝗟𝗶𝗻𝗸𝗲𝗱𝗜𝗻 𝗣𝗼𝘀𝘁 JavaScript has many small features that can make your code cleaner and easier to maintain. You can use these features to write better code. Here are some tricks to help you: - Remove duplicates from an array with Set - Convert anything to a boolean with double negation - Swap variables with destructuring - Use optional chaining to avoid long nested checks - Provide fallback values easily with ?? - Use console.table for debugging Some other tricks include: - Using Array.from to create an array - Using flat to flatten an array - Using Object.entries to get an array of key-value pairs - Using Object.fromEntries to create an object from an array - Using at to get the last element of an array - Using filter to remove falsey values - Using console.table to display data in a readable table - Using Promise.all to run multiple promises at the same time - Using debounce to delay a function - Using Math.random to generate a unique string - Using includes to check if an array includes a value - Using structuredClone for deep cloning You don't need to memorize all of these tricks. But using them can help you write cleaner code, reduce boilerplate, and improve readability. What's your favorite JavaScript trick? Share it in the comments. Source: https://lnkd.in/gUdrjCvm
To view or add a comment, sign in
-
🚀 JavaScript Concepts Series – Day 1 👀 Let's Revise Basics 🧐 📌 JavaScript has two main categories of data types: 1️⃣ Primitive Data Types (Immutable): These store a single value and are not objects. • String • Number • Boolean • Undefined • Null • Symbol • BigInt Example: let name = "Deepak"; // String let age = 27; // Number let isDev = true; // Boolean 2️⃣ Non-Primitive (Reference) Data Types: These store collections of data or complex entities. • Object • Array • Function 👀 Example: let user_Object = { name: "Deepak", role: "Developer" }; let skills_Array = ["JavaScript", "React"]; function greet_Function() { console.log("Hello Developer"); } 💡 Key Insight: Primitive values are stored by value, while non-primitive values are stored by reference. #javascript #webdevelopment #frontenddeveloper #reactjs #coding
To view or add a comment, sign in
-
-
𝗝𝗮 v𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗔𝗿𝗿𝗮𝘆𝘀 𝟭𝟬𝟭 When you work with JavaScript, you need to store multiple values together. You might want to store: - A list of fruits - Student marks - A list of tasks Instead of creating many separate variables, JavaScript provides a better solution called arrays. Arrays help you store and manage collections of data efficiently. You will learn the basics of arrays in JavaScript and how to work with them. You will learn: - What arrays are and why you need them - How to create an array - Accessing elements using an index - Updating elements in an array - The length property - Looping through arrays An array is a data structure that stores multiple values in a single variable. The values inside an array are stored in a specific order, and each value can be accessed using its index. For example: let fruits = ["Apple", "Banana", "Orange"]; You can store different data types in an array. Each element in an array has a position called an index. In JavaScript, array indexing starts from 0. You can access elements using their index. You can change any value in an array by using its index. The length property tells you how many elements are inside the array. You can use a loop to print or process every element in an array. Source: https://lnkd.in/gyY3cNir
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development