After playing around with map(), filter(), and reduce(), I wanted to go a bit deeper into how JavaScript handles function borrowing and context binding — so I decided to rebuild call(), apply(), and bind() 💪 Here’s how my mini versions turned out 👇 🧠 What I learned: How JavaScript functions can borrow context from other objects Why bind() returns a new function (instead of calling it immediately) How important it is to handle this carefully — one tiny mistake can break everything 😅 Building these gave me a much clearer understanding of how function context and execution work in JS 🔍 #javascript #ReactJs #nodeJs #interview-questions #programming
Rebuilding call(), apply(), and bind() in JavaScript
More Relevant Posts
-
Keywords in JavaScript - JavaScript Tutorial 09 🚀 ► https://lnkd.in/gJPYxAec ► In this tutorial, we dive into JavaScript keywords, explaining their use in defining variables, control flow, and more. Learn how to use them effectively to write clean, functional JavaScript code. JavaScript Tutorials Playlist: ► https://lnkd.in/getnwV5e #javascript #coding #programming #webdevelopment #learnjavascript #webdeveloper #coder #code #html #css
To view or add a comment, sign in
-
-
Recently I was preparing for JavaScript and I stumbled upon a simple concept — but most people don’t know the key differences between var and let. Here’s a quick example: ` for (var i = 0; i < 3; i++) { setTimeout(() => console.log(i), 1000); } // Output: 3 3 3 ` ` for (let i = 0; i < 3; i++) { setTimeout(() => console.log(i), 1000); } // Output: 0 1 2 ` Key differences: Scope: var is function-scoped, let is block-scoped. Hoisting & Temporal Dead Zone: var is hoisted and initialized with undefined, let is hoisted but not initialized — accessing it before declaration throws a ReferenceError. Understanding these small details can save you from tricky bugs, especially in loops and async code! #JavaScript #JS #WebDevelopment #FrontendDevelopment #Coding #LearnToCode #DeveloperTips #TechCommunity #CodeSnippet #Programming ## I’d appreciate it if you could share a few more examples to help me understand.
To view or add a comment, sign in
-
Keywords in JavaScript - JavaScript Tutorial 09 🚀 ► https://lnkd.in/ggh6CJ5Q ► In this tutorial, we dive into JavaScript keywords, explaining their use in defining variables, control flow, and more. Learn how to use them effectively to write clean, functional JavaScript code. JavaScript Tutorials Playlist: ► https://lnkd.in/g-TAmZZ3 #javascript #coding #programming #webdevelopment #learnjavascript #webdeveloper #coder #code #html #css
To view or add a comment, sign in
-
-
❓ Are “undefined” and “not defined” the same in JavaScript? Not really. In JavaScript, every declared variable automatically gets the placeholder undefined during the memory allocation phase — meaning the variable exists, but no value has been assigned yet. However, if you try to access a variable that was never declared, JavaScript throws not defined. ➡️ Undefined = declared but not assigned ➡️ Not Defined = not declared at all JavaScript is also a loosely typed language, so variables can change types freely. 💡 Pro tip: Never manually assign undefined. Let JavaScript handle that. #JavaScript #WebDevelopment #Programming #Frontend #LearningJS
To view or add a comment, sign in
-
🎥 Traditional Function vs Arrow Function in JavaScript (2025 Edition) JavaScript has evolved — and so has the way we write functions! In this video, I’ve explained the difference between traditional functions and arrow functions in the simplest way possible 👇 💡 Quick summary: Arrow functions are shorter & cleaner ✨ They don’t have their own this keyword Perfect for callbacks, promises & React components Traditional functions are still useful when you need your own this or arguments 👇 Watch this short video to see the real difference in action! 💬 What do you prefer — Arrow or Traditional? Share your choice in the comments! 👇 🔖 Hashtags (2025 optimized for LinkedIn reach) #JavaScript #WebDevelopment #FrontendDevelopment #CodingTips #CleanCode #Developers #ReactJS #ES6 #Programming #Tech2025 #JS2025 #LearnToCode #SoftwareEngineering #Samwithcode
To view or add a comment, sign in
-
JavaScript never fails to surprise. 😅 Check this out 👇 function hello() { console.log("Hello JS!"); } console.log(hello.name); // 👉 "hello" Wait… what?! How does JS know its own name? 🤯 Because every function in JavaScript is actually an object. And objects can have properties. So when you declare a function, JS secretly adds a .name property under the hood 👇 function hello() {} // → hello.name = "hello" Even anonymous ones get an identity if assigned to a variable 👇 const greet = function() {}; console.log(greet.name); // "greet" So yeah — your functions have name tags, even when you forget theirs. 😎 #javascript #frontend #webDevelopment #codingHumor #Coding #programming #developerLife
To view or add a comment, sign in
-
JS Tutorial #1: Introduction to JavaScript Title: JS Tutorial #1: What is JavaScript and How It Works Content: JavaScript is a programming language used to make web pages interactive. It runs in the browser and can also run on the server using Node.js. Code snippet: console.log("Hello, Cognothink!"); Engagement: Try running this in your browser console. What message do you see? Comment below! #JavaScript #Coding #LearnJS #WebDevelopment #Cognothink
To view or add a comment, sign in
-
Coding Brain Teaser: Write a JavaScript one-liner that prints numbers 1 to 100, but skips all numbers that contain the digit 7. Example: 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13... Think you can do it without using if statements? #JavaScript #ProblemSolving #CodeFun
To view or add a comment, sign in
-
Understanding Async JavaScript JavaScript is single-threaded, meaning it executes code line by line. Slow operations like fetching data from a backend can freeze your app while the code waits. Asynchronous programming solves this by allowing your code to keep running while waiting for tasks like API calls or file reads. Main async patterns in JavaScript: 1.Callbacks 2.Promises 3.Async / Await In the next post, I’ll explain callbacks with an example and their drawbacks.
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