🚀 Day 7/100 of #100DaysOfCode Today was all about strengthening JavaScript fundamentals — revisiting concepts that seem simple but are often misunderstood. 🔁 map() vs forEach() Both are used to iterate over arrays, but they serve different purposes: 👉 map() Returns a new array Used when you want to transform data Does not modify the original array Example: const doubled = arr.map(num => num * 2); 👉 forEach() Does not return anything (undefined) Used for executing side effects (logging, updating values, etc.) Often modifies existing data or performs actions Example: arr.forEach(num => console.log(num)); ⚔️ Key Difference: Use map() when you need a new transformed array Use forEach() when you just want to loop and perform actions ⚖️ == vs === (Equality in JS) 👉 == (Loose Equality) Compares values after type conversion Can lead to unexpected results Example: '5' == 5 // true 😬 👉 === (Strict Equality) Compares value AND type No type coercion → safer and predictable Example: '5' === 5 // false ✅ 💡 Takeaway: Small concepts like these make a big difference in writing clean, bug-free code. Mastering the basics is what separates good developers from great ones. 🔥 Consistency > Intensity On to Day 8! #JavaScript #WebDevelopment #CodingJourney #LearnInPublic #Developers #100DaysOfCode #SheryiansCodingSchool #Sheryians
JavaScript Fundamentals: map() vs forEach() and Equality in JS
More Relevant Posts
-
🚀 Day 6 of My JavaScript Journey Today was all about mastering Strings & Date Object in JavaScript — and honestly, it made me realize how powerful these basics really are 🔥 Here’s what I learned 👇 📌 Strings in JavaScript Different ways to create strings ("", '', and backticks ` `) Why backticks (template literals) are modern & super useful 💡 Finding string length using .length Accessing characters using index 📌 Important Concept Strings are immutable → original value can’t be changed ⚠️ 📌 String Methods Convert text: .toUpperCase() .toLowerCase() Search inside strings: .includes(), .indexOf() Extract parts: .slice() (supports negative index 🔥) .substring() Modify strings: .replace() .trim() Convert string to array: .split() 📌 Concatenation Combine strings using + Mixing numbers with strings → automatic type conversion 🤯 📌 Date Object (Real Game Changer 🕒) Getting current date & time Understanding UTC vs Local Time Formatting date (ISO & local formats) Extracting parts like year, month, day Creating custom dates 📌 Advanced Concepts Date.now() → gives milliseconds since Epoch (Jan 1, 1970) ⏳ Importance of UTC & Epoch Time in real-world apps Browser automatically converts UTC → Local Time 🌍 💡 Big Learning: Even basic things like strings & dates have deep concepts that are used in real-world applications like chat apps, logs, scheduling systems, etc. Consistency is the key 🔑 Day by day, getting closer to becoming a better developer 💻🔥 #JavaScript #WebDevelopment #MERNStack #CodingJourney #Day6 #Learning #Developers
To view or add a comment, sign in
-
-
🚀 JavaScript Simplified Series — Day 9 Functions are powerful… But JavaScript gives you even better ways to write them. 😎 Today let’s understand 3 important concepts that make your code clean, modern, and powerful: 👉 Arrow Functions 👉 Default Parameters 👉 Rest Parameters 🔹 1. Arrow Functions (Short & Clean) Earlier we used to write functions like this: function add(a, b) { return a + b } Now with arrow functions, we can write it in a cleaner way: const add = (a, b) => a + b 👉 Same result, less code 📌 Arrow functions make code short and readable 🔹 2. Default Parameters (No more undefined) Sometimes users don’t pass values 😵 function greet(name) { console.log("Hello " + name) } greet() 👉 Output: Hello undefined ❌ Solution → Default Parameters function greet(name = "Guest") { console.log("Hello " + name) } greet() 👉 Output: Hello Guest ✅ 📌 Default values prevent errors and make code safe 🔹 3. Rest Parameters (Handle multiple inputs) What if you don’t know how many inputs will come? 🤔 That’s where rest parameters come in. function sum(...numbers) { let total = 0 for (let num of numbers) { total += num } return total } console.log(sum(1, 2, 3, 4)) 👉 Output: 10 📌 ...numbers collects all values into an array 🔥 Simple Summary Arrow Function → short syntax Default Parameters → fallback values Rest Parameters → multiple inputs handle 💡 Programming Rule Write less code. Write clean code. Write smart code. If you want to learn JavaScript in a simple and practical way, you can follow these YouTube channels: • Rohit Negi • Hitesh Choudhary (Chai aur Code) 📌 Series Progress Day 1 → What is JavaScript Day 2 → Variables & Data Types Day 3 → Type Conversion & Operators Day 4 → Truthy & Falsy + Comparison Operators Day 5 → If Else + Switch + Ternary Day 6 → Loops Day 7 → Break + Continue + Nested Loops Day 8 → Functions Basics Day 9 → Arrow + Default + Rest Parameters Day 10 → Arrays (Next Post) Follow for more 🚀 #JavaScriptSimplified #javascript #webdevelopment #coding #programming #learninpublic #100DaysOfCode #frontenddevelopment #devcommunity #codingjourney #softwaredeveloper #techcommunity #dailylearning #codeeveryday
To view or add a comment, sign in
-
🚀 Day 70 | JavaScript Functions Deep Dive As part of my journey, today I focused on understanding different types of functions in JavaScript 💻 🔹 What I Worked On: • Function Declaration → basic function usage • Function Expression → assigning function to variable • Functions with & without parameters • Functions with return & without return • Object methods using this keyword • Anonymous functions • Higher-order functions (function inside function) • Callback functions • Recursive functions • IIFE (Immediately Invoked Function Expression) • Arrow functions 💡 Key Learning: • Functions are the core building blocks of JavaScript • Different types of functions are used based on the situation • Callbacks and higher-order functions are very important in real-world applications • Arrow functions provide shorter and cleaner syntax 🔥 Takeaway: 👉 Mastering functions is key to writing efficient and scalable JavaScript code Consistency is making concepts stronger day by day 🚀 #Day70 #JavaScript #Functions #WebDevelopment #ProblemSolving #CodingJourney #10000Coders #FrontendDeveloper #ValiBashaSir
To view or add a comment, sign in
-
🚀 Day 89 of My #100DaysOfCode Challenge I thought JavaScript automatically manages memory… so we don’t have to worry about it, right? 🤔 Wrong. Today I learned about something most beginners ignore — Garbage Collection in JavaScript. 💡 What actually happens? JavaScript automatically removes unused memory using something called Garbage Collection. It works on a simple idea: 👉 If something is not reachable, it gets removed from memory. 🧠 Example let user = { name: "Tejal" }; user = null; // now previous object becomes unreachable Now JavaScript will automatically clean this memory. --- ⚠️ But here’s the real problem… Even with automatic memory cleanup, memory leaks can still happen. Some common reasons: • Unused event listeners • Closures holding references • Global variables not cleared --- 💭 What I realized I used to think memory management is not my problem as a developer… But now I understand: 👉 Writing clean code also means not holding unnecessary memory --- JavaScript handles a lot for us… but understanding what’s happening behind the scenes makes a huge difference. Learning something new every day 💻✨ #Day89 #100DaysOfCode #JavaScript #WebDevelopment #CodingJourney #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Building Strong Foundations in JavaScript 💻✨ ✨Continuing my journey of improving core JavaScript skills through hands-on coding 👇 🔹 Loops Practice ✅ Printed numbers from 1–50 using: • for loop • while loop • do...while loop 🔹 Logic Building ✅ Generated multiplication table dynamically using user input 🔹 Iteration Techniques ✅ Used for...of for arrays and for...in for objects 🔹 Functions Practice ✅ Built a function to check Prime or Non-Prime numbers ✅ Implemented a Callback Function to calculate square of a number ✅ Practiced IIFE (Immediately Invoked Function Expression) to print today’s date 💡 Key Learnings: • Better understanding of loops and iteration • Clear idea of callback & higher-order functions • Debugged a real issue with IIFE and semicolons 😄 📌 Step by step, improving logic and confidence in JavaScript! #JavaScript #CodingJourney #LearningByDoing #FrontendDeveloper #WebDevelopment #KeepGrowing 🚀
To view or add a comment, sign in
-
🚀 Understanding var, let, and const in JavaScript While learning JavaScript, one of the most important concepts I revisited is the difference between var, let, and const. It may look basic, but it plays a huge role in writing clean and bug-free code. 🔹 var - Function scoped - Can be re-declared and re-assigned - Can cause unexpected bugs due to scope leakage 🔹 let - Block scoped - Cannot be re-declared - Can be re-assigned 🔹 const - Block scoped - Cannot be re-declared or re-assigned - Must be initialized at the time of declaration 💡 One key takeaway: Use const by default, let when values need to change, and avoid var in modern JavaScript. Small concepts like these build a strong foundation for writing better and more predictable code. #JavaScript #WebDevelopment #Frontend #Coding #Learning #MERNStack #100DaysOfCode
To view or add a comment, sign in
-
-
Day 2 of My JavaScript Journey 🚀 Today, I learned about values and variables in JavaScript. Values are the most fundamental unit of information in programming. Everything in JavaScript is built around values; numbers, text, true/false, etc. Variables, on the other hand, are like containers (or boxes) used to store these values so they can be reused later in a program. For example: let age = 20; Here, "20" is the value, and "age" is the variable storing it. One simple way to understand it: Values = the data Variables = where the data is stored Key takeaway: Variables make it easier to manage and reuse data efficiently in your code. I’m documenting my journey daily as I grow in JavaScript. #JavaScript #WebDevelopment #LearningInPublic #100DaysOfCode
To view or add a comment, sign in
-
🚀 Day 40/50 – Promises in JavaScript Today I learned about Promises in JavaScript, which help handle asynchronous operations more effectively. 🔹 A Promise represents a value that may be available now, later, or never. 🔹 It helps avoid callback nesting and makes code cleaner. 📌 Promise States ⏳ Pending – initial state ✅ Fulfilled – operation completed successfully ❌ Rejected – operation failed 📌 Creating a Promise let myPromise = new Promise(function(resolve, reject){ let success = true; if(success){ resolve("Operation Successful"); } else { reject("Operation Failed"); } }); 📌 Using .then() and .catch() myPromise .then(function(result){ console.log(result); }) .catch(function(error){ console.log(error); }); 📌 Promise with setTimeout Example function getData(){ return new Promise(function(resolve){ setTimeout(function(){ resolve("Data received"); }, 2000); }); } getData().then(function(data){ console.log(data); }); 💡 Key Learnings: ✅ Promises handle asynchronous operations ✅ .then() handles success ✅ .catch() handles errors ✅ Avoids callback nesting Thanks for Mentors 10000 Coders Raviteja T Abdul Rahman#Day40 #50DaysOfCode #JavaScript #Promises #AsyncJavaScript #WebDevelopment #CodingJourney
To view or add a comment, sign in
-
🚨 JavaScript finally started making sense after this… For a long time, I was just using functions in JS. But recently, I learned about: 👉 Scope 👉 Closures 👉 Higher Order Functions (HOF) And things clicked differently. 💡 Here’s what changed my understanding: ✅ Scope It’s not just about variables — it’s about where your code can access data ✅ Closures -> This blew my mind 🤯 A function doesn’t just execute… It remembers the environment where it was created. 👉 Even after the outer function is gone. ✅ Higher Order Functions Functions in JavaScript are not just “callable” They are: ✔ Passed as arguments ✔ Returned from other functions ✔ Stored like values 💡 The biggest shift for me: 👉 “Functions are not just actions, they are values with memory. They are first-class citizens in JavaScript” If you’re learning JavaScript: Don’t rush. These concepts feel hard at first… but once they click, everything changes. Course Instructor: Rohit Negi | Youtube Channel: CoderArmy. #JavaScript #WebDevelopment #Closures #fullstackdevelopment #LearnInPublic #coding
To view or add a comment, sign in
-
🚀 Day 14/100 – Arrays in JavaScript = Small Methods, Big Power! Today I went back to basics and realized something powerful 👇 👉 Mastering array methods = writing cleaner, smarter code. Here’s a quick breakdown of what I revised 👇 💡 Transform & Create split() → turns a string into an array "hello world".split(" ") // ["hello", "world"] 💡 Add Elements push() → add at the end unshift() → add at the beginning let arr = [2,3]; arr.push(4); // [2,3,4] arr.unshift(1); // [1,2,3,4] 💡 Remove Elements pop() → removes last element arr.pop(); // [1,2,3] 💡 Find & Check indexOf() → find position [10,20,30].indexOf(20) // 1 💡 Rearrange reverse() → flips the array [1,2,3].reverse() // [3,2,1] 💡 Convert toString() → array → string join() → array → custom string [1,2,3].join("-") // "1-2-3" ✨ Big Realization: These aren’t just “methods”… they’re tools to think better in code. The more I practice, the more patterns I start seeing 🔁 📈 Consistency > Intensity Day by day, getting sharper. #100DaysOfCode #JavaScript #CodingJourney #LearnInPublic #WebDevelopment #LearningInPublic Sheryians Coding School Sheryians Coding School Community
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