JavaScript Quick Notes (Save This) 🔹 Variables - let → block scoped - const → cannot reassign - var → function scoped (avoid in modern JS) 🔹 Data Types - String | Number | Boolean - null | undefined - Object | Array | Symbol | BigInt 🔹 Functions - Normal → function greet(){} - Arrow → const greet = () => {} 🔹 Important Concepts - Hoisting - Closures - Scope - Callback functions - Promises - async/await 🔹 Array Methods - map() | filter() | reduce() | find() | some() | every() 🔹 ES6+ Features - Destructuring - Spread (...) - Template literals - Default parameters Strong JavaScript fundamentals = Strong frontend foundation. Follow Ankit Sharma for more coding & interview notes.
JavaScript Fundamentals: Variables, Data Types, Functions & ES6+ Features
More Relevant Posts
-
💡 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
-
-
Question: What is the difference between var, let, and const in JavaScript? 💡 Answer: 1️⃣ var Function scoped Can be re-declared and updated Gets hoisted and initialized with undefined var a = 10 var a = 20 // allowed console.log(a) // 20 2️⃣ let Block scoped Can be updated but not re-declared in the same scope Hoisted but in Temporal Dead Zone (TDZ) let a = 10 a = 20 // allowed // let a = 30 ❌ Error 3️⃣ const Block scoped Cannot be updated or re-declared Must be initialized at declaration const a = 10 // a = 20 ❌ Error ⚡ Quick Summary FeaturevarletconstScopeFunctionBlockBlockRe-declare✅❌❌Update✅✅❌HoistingYesYes (TDZ)Yes (TDZ) 🎯 Interview Tip: Use const by default, let when value changes, and avoid var in modern JavaScript. 💬 Follow this series for daily JavaScript interview questions. #javascript #webdevelopment #frontend #mernstack #reactjs #codinginterview #softwareengineering
To view or add a comment, sign in
-
🚨 90% of JavaScript Developers Get This Wrong (Even with 2–4 years of experience 👀) No frameworks. No async tricks. Just pure JavaScript fundamentals. 🧠 Output-Based Question (Set + Type Checking) const s = new Set(); s.add(5); console.log(s.has('5')); ❓ What will be printed? ❌ Don’t run the code 🧠 Think like the JavaScript engine A. true B. false C. error D. undefined 👇 Drop ONE option only (no explanations yet 👀) ⚠️ Why This Question Matters Most developers assume: • JavaScript auto-converts types • '5' and 5 are basically the same • Collections behave like loose equality All three assumptions can break real applications. 🎯 What This Actually Tests • How Set stores values • Strict equality (===) behavior • Primitive type comparison • Why type consistency matters in production When this mental model is unclear: • Cache checks fail • Permission checks break • Duplicate detection becomes unreliable Strong JavaScript developers don’t rely on “automatic conversion”. They understand how values are actually stored and compared. 💡 I’ll pin the breakdown after a few answers. #JavaScript #JSFundamentals #CodingInterview #WebDevelopment #FrontendDeveloper #FullStackDeveloper #DevelopersOfLinkedIn #ProgrammingTips
To view or add a comment, sign in
-
-
90% of JavaScript developers Google the same syntax daily 🤔 So We built a JavaScript Full Cheat Sheet that replaces dozens of tabs in seconds. ⚡📌 If you're learning JavaScript programming or building real-world web development projects, this quick guide simplifies the essentials developers use every day: ✅ JavaScript Basics 🧠 – Variables, data types, type checking, and operators that form the foundation of clean code. ✅ Control Flow & Loops 🔁 – Master if/else, switch statements, for/while loops, and conditional logic used in real applications. ✅ Modern ES6+ Features 🚀 – Write better JavaScript code with arrow functions, destructuring, spread operators, and default parameters. ✅ DOM Manipulation 🖥️ – Use querySelector, event listeners, and dynamic UI updates to power interactive web apps. ✅ Async JavaScript ⏳ – Understand Promises, async/await, APIs, and JSON for scalable frontend and backend workflows. 🚀 Level Up Your Skills For deep-dives into these concepts, I highly recommend checking out the latest documentation and tutorials from JavaScript Mastery and GeeksforGeeks. 💬 Quick developer poll: Which JavaScript topic should we turn into the next cheat sheet? #imperio_coders #Javascript #WebDevelopment #Frontend #Education #Technology #Coding #Community #FutureOfWork #Careers
To view or add a comment, sign in
-
🔹 JavaScript Hoisting — Lecture 3 | Function Hoisting vs Variable Hoisting Many developers understand variable hoisting but get confused about function hoisting. Let’s clarify it clearly 👇 ✅ Function Declaration (Fully Hoisted) greet(); function greet(){ console.log("Hello Developer"); } Output: Hello Developer ✔ Function stored completely in memory ✔ Can be called before declaration ❌ Function Expression (Not Fully Hoisted) greet(); var greet = function(){ console.log("Hello"); } Output: TypeError Why? ✔ Variable is hoisted ❌ Function is not Real MERN Project Impact Wrong understanding of hoisting causes: ❌ Undefined state values in React ❌ API execution errors ❌ Hard-to-debug production bugs Quick Summary ✔ var → hoisted with undefined ✔ let/const → hoisted but in TDZ ✔ function declaration → fully hoisted ✔ function expression → not hoisted Understanding this improves your debugging and interview performance. 🔎 Keywords: JavaScript function hoisting, JavaScript execution context, advanced JavaScript concepts, MERN stack developer #JavaScriptLearning #MERNStack #FrontendDeveloper #WebDevTips #Programming
To view or add a comment, sign in
-
-
Mastering the Language of the Web: A Deep Dive into JavaScript Foundations I am sharing my personal JavaScript reference notes, covering everything from basic syntax to the complex logic required for modern web development. What this guide covers: * JavaScript Fundamentals: Variables, data types, and core syntax. * Control Flow & Logic: Mastering loops, conditionals, and algorithmic thinking. * Functional Programming: Deep dive into functions, scope, and execution environments. * Error Handling: How to interpret and handle basic exceptions to ensure program stability. * Development Workflow: Understanding the role of fundamental tools in the software development process. Whether you are preparing for a technical interview or refactoring a complex codebase, these notes are designed to be a quick yet thorough reference. Save this PDF for your next coding session! #JavaScript #WebDevelopment #CodingNotes #MERNStack #FrontendDeveloper #SoftwareEngineering #ProgrammingResources #CleanCode #LearnToCode #JS
To view or add a comment, sign in
-
🚀 **JavaScript: var vs let vs const (Every Developer Should Know This)** Understanding the difference between `var`, `let`, and `const` is one of the most important fundamentals in JavaScript. Let’s simplify it 👇 --- 🔴 **var** • Function scoped • Can be **reassigned** • Can be **redeclared** • Hoisted and initialized as `undefined` ```javascript var x = 10; x = 20; // ✅ allowed var x = 30; // ✅ allowed ``` ⚠️ Old JavaScript way. Avoid using `var` in modern code. --- 🟢 **let** • Block scoped `{ }` • Can be **reassigned** • ❌ Cannot be redeclared in the same scope • Hoisted but in **Temporal Dead Zone (TDZ)** ```javascript let y = 10; y = 20; // ✅ allowed let y = 30; // ❌ Error ``` ✔ Best for variables that will change. --- 🟣 **const** • Block scoped • ❌ Cannot be reassigned • ❌ Cannot be redeclared • Hoisted with **Temporal Dead Zone** ```javascript const z = 10; z = 20; // ❌ Error ``` ✔ Best for constants. --- 🎯 **Best Practice** ✔ Use **const by default** ✔ Use **let when value changes** ❌ Avoid **var** This makes your code **cleaner, safer, and predictable.** --- 💬 Interview Question: What is **Temporal Dead Zone (TDZ)** in JavaScript? Comment your answer 👇 --- #JavaScript #WebDevelopment #FrontendDevelopment #Coding #Programming #SoftwareEngineering #LearnToCode #DeveloperTips #JS #TechCommunity
To view or add a comment, sign in
-
-
But I can still change const even though it is immutable, Const a = [] a.push(7) Above code is completely valid. Can anyone explain that .. comment below 👇
Immediate Joiner - Software Developer | Full Stack Web Developer | NODE JS | REACT JS | PHP | JS | GITHUB | PYTHON | DJANGO | REST API | MYSQL | MONGO DB | FLASK | WORDPRESS
🚀 **JavaScript: var vs let vs const (Every Developer Should Know This)** Understanding the difference between `var`, `let`, and `const` is one of the most important fundamentals in JavaScript. Let’s simplify it 👇 --- 🔴 **var** • Function scoped • Can be **reassigned** • Can be **redeclared** • Hoisted and initialized as `undefined` ```javascript var x = 10; x = 20; // ✅ allowed var x = 30; // ✅ allowed ``` ⚠️ Old JavaScript way. Avoid using `var` in modern code. --- 🟢 **let** • Block scoped `{ }` • Can be **reassigned** • ❌ Cannot be redeclared in the same scope • Hoisted but in **Temporal Dead Zone (TDZ)** ```javascript let y = 10; y = 20; // ✅ allowed let y = 30; // ❌ Error ``` ✔ Best for variables that will change. --- 🟣 **const** • Block scoped • ❌ Cannot be reassigned • ❌ Cannot be redeclared • Hoisted with **Temporal Dead Zone** ```javascript const z = 10; z = 20; // ❌ Error ``` ✔ Best for constants. --- 🎯 **Best Practice** ✔ Use **const by default** ✔ Use **let when value changes** ❌ Avoid **var** This makes your code **cleaner, safer, and predictable.** --- 💬 Interview Question: What is **Temporal Dead Zone (TDZ)** in JavaScript? Comment your answer 👇 --- #JavaScript #WebDevelopment #FrontendDevelopment #Coding #Programming #SoftwareEngineering #LearnToCode #DeveloperTips #JS #TechCommunity
To view or add a comment, sign in
-
-
Today I solved a classic JavaScript problem: Removing duplicates from an array without using built-in methods like Set. Instead of relying on shortcuts, I implemented the logic manually using nested loops to fully understand how duplicate detection works internally. 🧠 Problem Given an array like: Copy code [1, 2, 2, 3, 4, 3] Return: [1, 2, 3, 4] 🔍 My Approach I created a new empty array called unique to store only distinct values. I looped through each element of the original array. For every element, I checked whether it already exists inside the unique array. If it does not exist, I pushed it into the unique array. If it already exists, I skipped it. This approach uses: An outer loop to iterate over the original array An inner loop to check for existing values A boolean flag (exists) to track duplicates 💡 Why I Chose This Approach While JavaScript provides a built-in way to remove duplicates using: [...new Set(arr)] I intentionally avoided it to: Strengthen my understanding of loops Improve my logical thinking Practice writing interview-style solutions Understand time complexity and algorithm behavior ⏱ Time Complexity O(n²) — because for each element, we may check the entire unique array. 🎯 Key Learning This problem helped me understand: Nested loop logic How duplicate detection works internally The importance of loop structure and placement Debugging mistakes like incorrect loop conditions Building strong fundamentals makes advanced concepts easier later. Consistency > shortcuts 💪 #JavaScript #ProblemSolving #WebDevelopment #100DaysOfCode #FrontendDeveloper #DSA #LearningInPublic
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