🧠 Day 10 of 21days challenge JavaScript call, apply, bind 🔥 They allow you to control what “this” refers to in a function. You can borrow functions and use them with different objects. For easy understanding :- call → pass arguments one by one apply → pass arguments as array bind → returns new function 👉 That’s how we control “this” in JavaScript This changed how I understand functions 🚀 #JavaScript #CallApplyBind #Frontend
JavaScript call, apply, bind explained
More Relevant Posts
-
JavaScript basics that still matter: let vs var vs const var: • Function scoped • Can be redeclared let: • Block scoped • Can be updated const: • Block scoped • Cannot be reassigned Small concepts, big impact on clean code. Which one do you use the most? #JavaScript #CodingTips #Frontend
To view or add a comment, sign in
-
🚀 💡 JavaScript Tricky Question Explanation const arr = [4, 10, 2, 8]; const result = arr.find(num => num > 5) + arr.findIndex(num => num > 5); console.log(result); 👉 Output: 11 👉 Explanation: * find() returns the first value > 5 → `10` * findIndex() returns its index → `1` * Final result → `10 + 1 = 11` ⚡ Both stop at the **first match** #JavaScript #WebDevelopment #Frontend #CodingInterview #JSConcepts
To view or add a comment, sign in
-
How to understand a Javascript function? What arguments are passed? Why it is passed? What is the function doing inside? What it is returning? What does the JS doing with the returned value? If you can answer to all the questions then you have understood a function. #Javascript #frontenddevelopement
To view or add a comment, sign in
-
What is a closure in JavaScript? A closure is a function that remembers variables from its outer scope even after that scope has finished executing. Why does this work? - `createCounter` runs once - It creates a variable `count` - The inner function “closes over” that variable - Even after `createCounter` finishes, `count` is still accessible Each time `counter()` runs: → it uses the same preserved state 💡 Closures are everywhere: - React hooks - Event handlers - Memoization - Encapsulation patterns They’re not just a concept — they’re part of how JavaScript manages state. #Frontend #JavaScript #React #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
-
💻 JavaScript Array Methods – Hands-on Practice Completed Worked on some fundamental Array methods in JavaScript and practiced how they actually behave 👇 ✔️ Used push() and pop() to add/remove elements from the end ✔️ Used unshift() and shift() to work with elements at the beginning ✔️ Explored length to track array size ✔️ Understood the difference between slice() and splice() through practice 💡 Key takeaway: slice() does not modify the original array, while splice() directly changes it — this difference is really important while working with data. Practicing these basics is helping me build a strong foundation in JavaScript 🚀 #JavaScript #WebDevelopment #Frontend #CodingJourney #LearningByDoing
To view or add a comment, sign in
-
-
🧠 Day 18 of 21days challenge JavaScript WeakMap ⚡ WeakMap is a collection where keys must be objects. It helps in memory management because keys are weakly referenced. For easy understanding :- WeakMap = object keys only Garbage collected if no other references Useful to store private data 👉 That’s how memory leaks can be prevented This changed how I manage objects efficiently 🚀 #JavaScript #WeakMap #InterviewPrep #Frontend
To view or add a comment, sign in
-
-
🚨 JavaScript Gotcha: When 0 Actually Matters One of the most subtle bugs in JavaScript comes from using the logical OR (||) for default values. const timeout = userTimeout || 3000; Looks fine… until userTimeout = 0. 👉 JavaScript treats 0 as falsy, so instead of respecting your value, it silently replaces it with 3000. 💥 Result? Unexpected behavior. ✅ The Fix: Use Nullish Coalescing (??) const timeout = userTimeout ?? 3000; This only falls back when the value is null or undefined — not when it’s 0. 💡 When does 0 actually matter? ⏱️ Timeouts & delays → 0 can mean run immediately 📊 Counters & stats → 0 is a valid value, not “missing” 💰 Pricing / discounts → Free (0) ≠ undefined 🎚️ Sliders / configs → Minimum values often start at 0 🧠 Rule of thumb: Use || when you want to catch all falsy values (0, "", false, etc.) Use ?? when you only want to catch missing values (null, undefined) ⚡ Small operator. Big difference. Cleaner logic. #reactjs,#nodejs #JavaScript #WebDevelopment #CleanCode #Frontend #ProgrammingTips #DevTips #CodeQuality #SoftwareEngineering
To view or add a comment, sign in
-
-
🧠 Day 7 of 21days challenge JavaScript Debouncing 🔥 Debouncing limits how often a function can run. It waits for a pause in repeated events before executing. For easy understanding : Debounce = delay function execution Runs only after user stops triggering Helps reduce unnecessary calls Code output : // User types fast: J → JS → JS C → JS Currying // Only last input ("JS Currying") logs after 1 second 👉 That’s why only final input triggers search This changed how I optimize performance 🚀 #JavaScript #Debounce #Frontend
To view or add a comment, sign in
-
-
🎡 JavaScript Event Loop — Quick Challenge Most developers get this wrong 👀 🧪 What will be the output of this code? (Check the image 👇) 👉 Drop your answer in the comments before scrolling. ⏳ Think first... . . . ✅ Answer 1. Start 4. End 3. Promise.then (Microtask) 2. setTimeout (Macrotask) 🔍 Simple Explanation JavaScript runs code in this order: 1️⃣ First → Normal (synchronous) code 2️⃣ Then → All Promises (Microtasks) 3️⃣ Finally → setTimeout (Macrotasks) 👉 Even if setTimeout is 0, it still runs later. 🧠 Takeaway Promise.then → runs sooner setTimeout → runs later Simple rule, but super useful in real projects. 💬 What was your answer? #JavaScript #EventLoop #Frontend #WebDevelopment #CodingTips
To view or add a comment, sign in
-
-
🚀 JavaScript Output Challenge #5 (Hoisting Trap) Looks simple… but is it really? 👀 🧠 Question: 👉 What will be printed in the console? ⚠️ Don’t run the code. Try to think about: Hoisting Function declaration vs variable declaration Execution context 🤔 Bonus: Why does JavaScript behave this way internally? 💬 Drop your output + reasoning in comments Let’s see who understands JavaScript deeply 🔥 📌 Detailed explanation coming soon... #javascript #webdevelopment #frontend #codingchallenge #reactjs #nodejs
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