Today I learned about three important JavaScript loops: forEach() for...in for...of Each one has its own purpose: forEach() — used to loop through array elements for...in — used to iterate over object keys for...of — used to loop through iterable values like arrays or strings Understanding the difference between them really cleared things up for me 💡 #JavaScript #WebDevelopment #LearningJourney #Frontend #100daysofcode
Mastering JavaScript Loops: forEach(), for...in, for...of
More Relevant Posts
-
🚀 Just finished a small JavaScript project! I built a modal window that opens and closes when clicking buttons, the overlay, or pressing the Escape key. 🧠 This helped me understand: - querySelector / querySelectorAll - addEventListener - classList.add() and .remove() - Keyboard events like keydown Check out the full project on GitHub 👇 🔗 https://lnkd.in/euzZQVBA #JavaScript #WebDevelopment #Frontend #LearningInPublic #Makhilens
To view or add a comment, sign in
-
Going back to basics 🌱 What does "typeof null" returns ?? Surprisingly, it returns "object" Yes it has been a "bug" in Javascript since the very beginning as i have read. When Javascript was first designed, values were stored in a way that caused "null" to be mistakenly tagged as an "object". And even after years, it remains that way for backward compatibility. So, "typeof null" is "object" but null is not an "object". #Javascript #Frontend
To view or add a comment, sign in
-
-
💻 JavaScript Fun Today! Here’s what I learned: 🎯 How to use variables (var, let, const) and understand their differences 🎯 How to interact with users using alert() and prompt() 🎯 Playing with strings, numbers, and template literals 🎯 Linking JS files to HTML and using defer for smoother loading 💬 Would love to hear your tips for making JS more interactive and fun! #JavaScript #WebDevelopment #Frontend #JSBasics #100DaysOfCode #LearningInPublic #BuildInPublic
To view or add a comment, sign in
-
-
🔥 Today I finally understood one of JavaScript’s most mind-bending concepts — CLOSURES! At first, I used to see “closure” and think — what even is that?! 😅 But once I got it, it completely changed how I think about functions in JS. In simple words 👇 A closure is when an inner function remembers and accesses variables from its outer function — even after the outer function has finished running. quick example: function counter() { let count = 0; return function() { count++; return count; } } const add = counter(); console.log(add()); // 1 console.log(add()); // 2 Even though counter() has finished, the inner function remembers count — that’s the magic of closures 🔥 It’s one of those things that makes JavaScript feel alive — functions with memory! #JavaScript #Closures #WebDevelopment #LearningInPublic #FrontendDeveloper #100DaysOfCode #CodingJourney
To view or add a comment, sign in
-
-
Daily tip: Use optional chaining in JavaScript to safely access nested properties. Example: const city = user?.address?.city ?? 'Unknown'. Small trick, big payoff. If you’re exploring React, remember to keep components focused and reusable. What's your current favorite JS trick? #JavaScript #React #WebDev
To view or add a comment, sign in
-
Today is Day 10, and I explored some of the most important function-related concepts in JavaScript: ✅ Pure Functions ✅ First-Class & Higher-Order Functions ✅ map(), filter(), and reduce() ✅ Argument Object & Rest Parameter ✅ Variable Scope (Global, Local, Block) ✅ Scope & Scope Chain ✅ Recursion & Closures #Day10 #JavaScript #FrontendDevelopment #100DaysOfCode #LearningInPublic
To view or add a comment, sign in
-
🎯 Practiced JavaScript DOM today learned how to manipulate multiple elements and how JS interacts with each node in real time. It’s amazing how small scripts can change an entire webpage dynamically! 💻 Check it out here 👉 https://lnkd.in/g9cWfhaH #JavaScript #WebDevelopment #Frontend #LearningJourney
To view or add a comment, sign in
-
-
Ever seen a variable live even after its function is done? 🤔 That’s not a bug — that’s Closure, one of JavaScript’s most powerful (and tricky) features 💡 Let’s look at a simple example 👇 function counter() { let count = 0; return function () { count++; console.log(count); }; } const increment = counter(); increment(); // 1 increment(); // 2 increment(); // 3 Wait… how does count still remember its value? Didn’t the counter() function finish already? 😅 Here’s the magic 🪄 > A closure allows a function to “remember” the variables from the scope in which it was created — even after that scope is gone. In this example, The inner function still has access to count, Because it closes over the variables from its outer function. That’s why we call it a Closure 🔁 Closures are the reason we can create: ✅ Private variables ✅ Function factories ✅ Modular, memory-efficient code In short — > A closure is how JavaScript gives functions memory 🧠 #JavaScript #Closures #WebDevelopment #Frontend #MERNStack #NodeJS #ReactJS #Coding #SoftwareEngineering #Developers #JSFundamentals
To view or add a comment, sign in
-
🚀 Day 3 – Level 3 of my 4 Days JavaScript Challenge! 💡 Today's Topic: Difference between call() and apply() in JavaScript Both are used to set the this context and invoke a function immediately — but the way they pass arguments makes all the difference 👇 🪄 Quick Tip 🔹 Use call() when you already know the exact number of arguments. 🔹 Use apply() when arguments are coming dynamically as an array. #JavaScript #WebDevelopment #CodingChallenge #Frontend #LearnInPublic
To view or add a comment, sign in
-
-
Exploring the power of DOM manipulation in JavaScript, I created a simple yet fun project — a Color Changer that updates the background color dynamically with just a click. Through this project, I learned how to: ✨ Access and modify HTML elements using JavaScript 🎯 Add event listeners for interactivity 🌈 Work with random colors and CSS styling through JS Small projects like these help me strengthen my fundamentals and build confidence in JavaScript. 🚀 Here’s a quick preview 👇 (You can attach a screenshot or short video demo here 🎥) #JavaScript #WebDevelopment #Frontend #CodingJourney #LearningByDoing #pythondeveloper.
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