🚀 Day 5 of My 30 Days of JavaScript Challenge 🧩 Problem: Apply Transform Over Each Element in Array (LeetCode #2635) Given an integer array arr and a mapping function fn, return a new array such that: newArray[i] = fn(arr[i], i) Solve this without using the built-in Array.map() method. 💻 Language: JavaScript ❓ Question: https://lnkd.in/eq8qYfpb 💡 Solution: https://lnkd.in/eT5U2kBp 🧠 Concepts Used: Higher-order functions (passing functions as arguments) Loops and callback functions Core idea behind how .map() works internally 📚 Takeaway: By recreating the Array.map() method manually, I learned how callback execution and array transformations work under the hood — a must-know for mastering JavaScript fundamentals. #Day5 #JavaScript #30DaysOfCode #LeetCode #CodingChallenge #WebDevelopment #FrontendDevelopment #100DaysOfCode
Recreating Array.map() in JavaScript for LeetCode Challenge
More Relevant Posts
-
🚀 Day 7 of My 30 Days of JavaScript Journey ✅ Challenge: Array Reduce Transformation (LeetCode #2626) Write a function reduce(nums, fn, init) that processes each element of the array using the given reducer function fn, starting from an initial value init. This function should accumulate results sequentially and return the final value — implemented without using the built-in Array.reduce() method. 💻 Language Used: JavaScript ❓ Problem Link: https://lnkd.in/gxsp26cz 💡 Solution: https://lnkd.in/giZj_hYw 🧠 Concept Highlighted: This problem deepened my understanding of accumulator functions, data aggregation, and sequential computation in JavaScript. It helped me explore how the powerful reduce() method works behind the scenes — a key tool for transforming and summarizing data efficiently. #Day7 #JavaScript #LeetCode #30DaysOfCode #CodingChallenge #WebDevelopment #FrontendDevelopment #LearningEveryday #ProblemSolving #FunctionalProgramming
To view or add a comment, sign in
-
🚀 Day 4 of My 30 Days of JavaScript Challenge 🧩 Problem: Create Counter II (LeetCode #2665) Write a function createCounter(init) that returns an object with three functions: increment() → increases the current value by 1 and returns it decrement() → decreases the current value by 1 and returns it reset() → resets the value back to init and returns it 💻 Language: JavaScript ❓ Question: https://lnkd.in/eupkr-a3 💡 Solution: https://lnkd.in/eq3BEsn2 🧠 Concepts Used: Closures for maintaining private state across function calls Object methods to encapsulate multiple related actions State management inside functions 📚 Takeaway: This challenge reinforces closures and encapsulation — two powerful ideas that make JavaScript functions behave like real objects with memory and behavior. #Day4 #JavaScript #30DaysOfCode #LeetCode #CodingChallenge #WebDevelopment #FrontendDevelopment #100DaysOfCode
To view or add a comment, sign in
-
🚀 Day 11 of My 30 Days of JavaScript Journey ✅ Challenge: Memoize (LeetCode #2623) The task was to create a memoize(fn) function that caches results so that repeated calls with the same inputs return instantly from cache — without re-executing the original function. This helps improve performance when dealing with expensive computations like fibonacci or factorial, and even simple operations like sum when called repeatedly. 💻 Language Used: JavaScript ❓ Problem Link: https://lnkd.in/gnHmbPih 💡 Solution: https://lnkd.in/gGJZjYY9 🧠 Concept Highlighted: Memoization is a powerful optimization technique that uses caching to avoid repeating calculations. It strengthens understanding of closures, function arguments handling, and performance-oriented JavaScript. #JavaScript #LeetCode #30DaysOfCode #CodingChallenge #WebDevelopment #FrontendDevelopment #Memoization #PerformanceOptimization #LearningEveryday #ProblemSolving
To view or add a comment, sign in
-
🚀 Day 6 of My 30 Days of JavaScript Challenge 🧩 Problem: Filter Elements from Array (LeetCode #2634) Given an integer array arr and a filtering function fn, return a new array filteredArr that only includes elements where fn(arr[i], i) returns a truthy value. Solve this without using the built-in Array.filter() method. 💻 Language: JavaScript ❓ Question: https://lnkd.in/eSGpgXcM 💡 Solution: https://lnkd.in/ekA6y-u3 🧠 Concepts Used: Higher-order functions and callbacks Conditional checks for truthy/falsy values Understanding Boolean(value) behavior in JavaScript 📚 Takeaway: Rebuilding filter() from scratch deepens understanding of conditional logic, iteration, and truthy/falsy evaluation — all essential for functional programming in JavaScript. #Day6 #JavaScript #30DaysOfCode #LeetCode #CodingChallenge #WebDevelopment #FrontendDevelopment #100DaysOfCode
To view or add a comment, sign in
-
🚀 Day 4 of My 30 Days of JavaScript Journey ✅ Challenge: Create Counter Object (LeetCode #2665) Write a function createCounter(init) that returns an object with three functions: increment() → increases the value by 1 and returns it. decrement() → decreases the value by 1 and returns it. reset() → resets the value to the initial value and returns it. 💻 Language Used: JavaScript ❓ Problem Link: https://lnkd.in/gKxPxb8Y 💡 Solution: https://lnkd.in/g3jv6Nfi 🧠 Concept Highlighted: This challenge strengthens understanding of closures and object methods in JavaScript. It shows how functions can preserve and modify internal state — a key concept in building dynamic, stateful applications. #JavaScript #LeetCode #30DaysOfCode #CodingChallenge #WebDevelopment #FrontendDevelopment #LearningEveryday #Closures #ProblemSolving
To view or add a comment, sign in
-
🚀 Day 10 of My 30 Days of JavaScript Challenge 🧩 Problem: Allow One Function Call (LeetCode #2666) Given a function fn, return a new function that ensures fn can only be called once. The first call returns the actual result, and every subsequent call returns undefined. 💻 Language: JavaScript 📖 Problem Link: https://lnkd.in/epnrfahZ 💡 Solution: https://lnkd.in/eGQKWkEk 🧠 Concepts Used Closures to store state (whether function is already called) Function Wrapping Higher-Order Functions 📚 Takeaway This problem is a great example of how closures preserve state between function calls — an essential concept for: Memoization API rate-limiting Event listener control #Day10 #JavaScript #30DaysOfCode #LeetCode #WebDevelopment #CodingChallenge #Closures #FrontendDevelopment #100DaysOfCode
To view or add a comment, sign in
-
Day 5 of #30DaysOfJavaScript: Creating My Own Filter Function from Scratch! 🎯 Today, I tackled a great exercise that challenged me to build a custom filter function without using JavaScript’s built-in .filter() method. This involved iterating over an array and using a callback function to decide which elements to keep based on truthy values. Here’s a peek at the solution I wrote: Key takeaways from this challenge: Deepened my understanding of higher-order functions and callback usage. Learned how to evaluate truthy and false values in JavaScript more effectively. Gained appreciation for the power and convenience of built-in array methods by implementing one manually. This hands-on approach is helping me grasp fundamental JavaScript concepts in detail while preparing for real-world coding challenges. Excited to keep growing and solving more problems along the way! Let’s connect and share knowledge. #JavaScript #CodingChallenge #WebDevelopment #LeetCode #ArrayMethods #LearningByBuilding #DeveloperJourney
To view or add a comment, sign in
-
-
🚀 Day 3 of My 30 Days of JavaScript Challenge 🧩 Problem: Implement expect() Function (LeetCode #2704) Write a function expect that helps developers test their code. It takes a value val and returns an object with two methods: toBe(val) → returns true if both values are strictly equal (===), else throws "Not Equal" notToBe(val) → returns true if both values are not strictly equal (!==), else throws "Equal" 💻 Language: JavaScript ❓ Question: https://lnkd.in/eJcRKeme 💡 Solution: https://lnkd.in/eZY9mYHN 🧠 Concepts Used: Higher-order functions (function returning object with functions) Error handling using throw new Error() Strict equality (===) in JavaScript 📚 Takeaway: This exercise reinforces function design, object methods, and error handling — the foundation for building custom testing utilities and debugging tools in JavaScript. #Day3 #JavaScript #LeetCode #30DaysOfCode #CodingChallenge #WebDevelopment #FrontendDevelopment #100DaysOfCode
To view or add a comment, sign in
-
✨ Day 10 — How JavaScript Code Works Behind The Scenes! ✨ Today, I went beyond the syntax to understand how JavaScript actually executes code behind the scenes — the hidden engine that makes everything run! ⚙️💻 I began by learning about the Execution Context — the environment where JavaScript code runs — and how it’s created in two key phases: Memory Allocation and Execution. 🧠 Then, I explored how Function Call Execution Contexts are formed and managed using the Call Stack and Heap, helping me visualize how JavaScript handles both primitive values and objects in memory. 📚 I also dived deep into Hoisting, understanding why variables declared with var show up as undefined, and how let & const behave differently due to the Temporal Dead Zone. ⚡ Finally, I wrapped up by studying Function Expressions, Hoisting mechanics, and how the JavaScript Interpreter runs code step by step — truly connecting all the dots behind execution! 🚀 This session gave me a crystal-clear understanding of what happens before a single line of JavaScript runs — the real “magic” behind the language! ✨ #Day10 #JavaScript #WebDevelopment #100DaysOfCode #LearningEveryday #CodingJourney #FrontendDevelopment #Hoisting #ExecutionContext #JSBehindTheScenes
To view or add a comment, sign in
-
-
🚀 Starting My JavaScript Revision Journey! Body: Yesterday, I went back to the basics of JavaScript to strengthen my foundation. Here’s what I revised: 🟡 Variables — var, let, and const and when to use them 🟡 Scope — Global variables (accessible everywhere) — Local variables (accessible within a function/block) 🟡 Data Types — Primitive: string, number, boolean, null, undefined, symbol, bigint — Non-Primitive: objects, arrays, functions It’s amazing how revisiting fundamentals clears a lot of confusion! What JavaScript concept took you time to understand when starting out? #JavaScript #BackendDevelopment #LearningJourney #Coding
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