🎯 Interview Question #7 — 🔥 call vs apply vs bind(Explained So Clearly You’ll Never Forget It!) Most developers use functions… But very few truly understand how to control this in JavaScript. These 3 methods separate juniors from seniors 👇 🔥 1️⃣ call() — Invoke Immediately (Pass Arguments Normally) call runs the function instantly, with a given this. function greet(a, b) { console.log(this.name, a, b); } greet.call({ name: "Rohit" }, "Hello", "World"); ✔ passes arguments one by one ✔ invokes right now 🔥 2️⃣ apply() — Invoke Immediately (Pass Arguments as Array) Same as call(), but arguments must be an array. greet.apply({ name: "Rohit" }, ["Hello", "World"]); Use when your data is already in an array. ✔ invokes immediately ✔ best for array argument lists 🔥 3️⃣ bind() — Returns a New Function (Does NOT Invoke) bind() does NOT run the function. It returns a new function with this permanently attached. const fn = greet.bind({ name: "Rahul" }, "Hello", "World"); fn(); // runs later Best for: callbacks event handlers React class components delayed execution #JavaScript #JS #WebDevelopment #FrontendDevelopment #ReactJS #NextJS #CodingTips #TechTips #InterviewPreparation #FrontendInterview #JavaScriptInterview #WebDevCommunity #LearnJavaScript #ProgrammingTips #TechCareers #CodeNewbie #DevelopersCommunity #SoftwareEngineering #100DaysOfCode #DevLife
JavaScript call, apply, and bind explained
More Relevant Posts
-
𝟳𝟬 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 𝗤𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀 𝗘𝘃𝗲𝗿𝘆 𝗙𝗿𝗼𝗻𝘁𝗲𝗻𝗱 𝗗𝗲𝘃𝗲𝗹𝗼𝗽𝗲𝗿 𝗠𝘂𝘀𝘁 𝗠𝗮𝘀𝘁𝗲𝗿 Most developers say they “know JavaScript” — but interviews quickly reveal the gaps. This curated list of 70 JavaScript interview questions is designed to test real understanding, not rote learning. It covers core fundamentals, tricky edge cases, async behaviour, memory, performance, and real-world patterns that interviewers actually care about. 📌 𝗧𝗼𝗽𝗶𝗰𝘀 𝗖𝗼𝘃𝗲𝗿𝗲𝗱: 𝐽𝑎𝑣𝑎𝑆𝑐𝑟𝑖𝑝𝑡 𝑓𝑢𝑛𝑑𝑎𝑚𝑒𝑛𝑡𝑎𝑙𝑠 & 𝑒𝑥𝑒𝑐𝑢𝑡𝑖𝑜𝑛 𝑚𝑜𝑑𝑒𝑙 𝑣𝑎𝑟 𝑣𝑠 𝑙𝑒𝑡 𝑣𝑠 𝑐𝑜𝑛𝑠𝑡, 𝑠𝑐𝑜𝑝𝑒 & ℎ𝑜𝑖𝑠𝑡𝑖𝑛𝑔 𝐶𝑙𝑜𝑠𝑢𝑟𝑒𝑠, 𝑙𝑒𝑥𝑖𝑐𝑎𝑙 𝑒𝑛𝑣𝑖𝑟𝑜𝑛𝑚𝑒𝑛𝑡 & 𝑇𝐷𝑍 𝐸𝑣𝑒𝑛𝑡 𝑙𝑜𝑜𝑝, 𝑚𝑖𝑐𝑟𝑜𝑡𝑎𝑠𝑘𝑠 & 𝑚𝑎𝑐𝑟𝑜𝑡𝑎𝑠𝑘𝑠 𝑃𝑟𝑜𝑚𝑖𝑠𝑒𝑠, 𝑎𝑠𝑦𝑛𝑐/𝑎𝑤𝑎𝑖𝑡 & 𝑒𝑟𝑟𝑜𝑟 ℎ𝑎𝑛𝑑𝑙𝑖𝑛𝑔 𝑃𝑟𝑜𝑡𝑜𝑡𝑦𝑝𝑒𝑠 & 𝑖𝑛ℎ𝑒𝑟𝑖𝑡𝑎𝑛𝑐𝑒 𝑡ℎ𝑖𝑠, 𝑐𝑎𝑙𝑙/𝑎𝑝𝑝𝑙𝑦/𝑏𝑖𝑛𝑑 𝐸𝑞𝑢𝑎𝑙𝑖𝑡𝑦, 𝑐𝑜𝑒𝑟𝑐𝑖𝑜𝑛 & 𝑡𝑟𝑖𝑐𝑘𝑦 𝑜𝑢𝑡𝑝𝑢𝑡𝑠 𝑀𝑒𝑚𝑜𝑟𝑦 𝑚𝑎𝑛𝑎𝑔𝑒𝑚𝑒𝑛𝑡 & 𝑔𝑎𝑟𝑏𝑎𝑔𝑒 𝑐𝑜𝑙𝑙𝑒𝑐𝑡𝑖𝑜𝑛 𝑃𝑒𝑟𝑓𝑜𝑟𝑚𝑎𝑛𝑐𝑒 𝑝𝑎𝑡𝑡𝑒𝑟𝑛𝑠 (𝑑𝑒𝑏𝑜𝑢𝑛𝑐𝑒, 𝑡ℎ𝑟𝑜𝑡𝑡𝑙𝑒, 𝑚𝑒𝑚𝑜𝑖𝑧𝑎𝑡𝑖𝑜𝑛) 𝐶𝑜𝑚𝑚𝑜𝑛 𝑖𝑛𝑡𝑒𝑟𝑣𝑖𝑒𝑤 𝑡𝑟𝑎𝑝𝑠 & 𝑒𝑑𝑔𝑒 𝑐𝑎𝑠𝑒𝑠 👉 Whether you’re preparing for frontend, full-stack, or React interviews, these questions will help you think clearly, explain confidently, and perform under pressure. #JavaScript #JavaScriptInterview #FrontendInterviews #WebDevelopment #FrontendDevelopment #ReactJS #InterviewPreparation #Coding
To view or add a comment, sign in
-
💡 Day 7 of React: Turning a Project Task into an Interview Answer! Today, we escalated our use of props by passing complex data structures (like objects and arrays) to a reusable component, continuing the Tailwind CSS project. This hands-on work directly addresses a common interview question: "How do you pass multiple, varied data points to a single component efficiently?" My answer, learned today: Structure Data as an Object: Package all related component data (e.g., username, buttonText, imageURL) into a single JavaScript object. Pass the Object as a Single Prop: Use the spread operator or pass the entire object as a value to the props attribute (e.g., <Card userDetails={userData} />). Destructure in the Child Component: Destructure the object directly from the props argument in the child component's function signature for cleaner code. This technique keeps the component call clean and makes components highly flexible and maintainable. Next up: tackling other React Interview essentials! #ReactJS #InterviewPrep #Props #TailwindCSS #FrontendDeveloper #CodingJourney
To view or add a comment, sign in
-
-
#javascript Array.map() feels obvious when you use it. It doesn’t feel obvious when you try to write it. While implementing it from scratch, a few things became very clear: • map() always creates a new array Touching the original one means it’s wrong. • You can’t assume all indexes exist Sparse arrays force you to check before reading values. • The loop is not the important part The callback is what shapes the result. • thisArg affects real behavior Ignoring it breaks how map() is expected to work. • The callback gets more than just the value Index and array access enable many real-world use cases. The implementation is small. The thinking behind it isn’t. This is exactly why Array.map() is asked in JavaScript interviews. 📺 I’ve broken this down step-by-step in my JavaScript Interview Series on YouTube Link is in the first comment If you’ve never written map() yourself, it’s worth doing once. #JavaScript #JavaScriptInterview #FrontendDevelopment #ArrayMethods
To view or add a comment, sign in
-
"Mastering JavaScript’s hidden comparison traps is what separates a beginner from a real frontend developer — and this snippet shows exactly why. Expressions like [] == ![], 0 == '0', '' == false, and [1,2] == '1,2' reveal how type coercion silently shapes JavaScript’s behavior, making interviews tricky and debugging even harder. If you're preparing for web development or tech interviews, understanding these conversions is essential. Try solving the code yourself, share your answers, and challenge your friends! 🚀👇 #javascript #JavaScriptConcepts #TechEducation #CodeExplained #ProgrammingTips #JSProgramming #JavaScriptTricks #WebDevTips #SoftwareEngineering #LearnToCode #JavaScriptFunctions #CodeLearning #ProgrammingLife #DeveloperCommunity #TechLearning #JavaScriptSkills #CodingExploration #JavaScriptProgramming #WebDevJourney #ProgrammingExplained #TechKnowledge #JavaScriptDevelopment #CodingSkills #WebDevelopmentExplained #JavaScriptLearning #CodingCommunity #TechTutorial #ProgrammingLanguages
To view or add a comment, sign in
-
If you are preparing for Javascript Interview this quick revision topics might help you. Sharing this to stay accountable—and maybe help someone else preparing. Here’s what I’m actively revising 👇 ⚙️ Core JavaScript Internals • Type coercion and implicit conversions • var, let, const (hoisting, TDZ, reference errors) • Function hoisting vs variable hoisting • Primitive vs non-primitive data types • null vs undefined • Strict mode and why it exists ⏳ Async JavaScript & Execution Model • Event Loop (call stack, microtasks, macrotasks) • setTimeout / setInterval and how to stop them • Callbacks and callback hell • Promises (then, catch, finally, Promise APIs) • async/await vs promises • Writing async code in multiple patterns • Web Workers and off-main-thread execution 🧠 Functions, Scope & Objects • Closures (real use cases, not theory) • Currying (normal & infinite) • IIFE and use cases • Arrow functions vs normal functions • this keyword in different contexts • call, apply, bind • Shallow vs deep copy • Object.freeze() vs Object.seal() 🔗 Prototypes, OOP & FP • Prototypes & prototypal inheritance • Classes, constructors & super • Core OOP concepts in JavaScript • Functional programming vs OOP • Common design patterns • SOLID principles explained in JS terms 📦 Arrays, Objects & DOM • Array methods (map, filter, reduce, forEach) • for…of vs for…in • String, object & array utility methods • DOM vs BOM • Event bubbling, capturing & delegation 🚀 Performance & Practical Topics • Debouncing & throttling • Immutability • Memory leaks & garbage collection • Improving JavaScript performance • ES6+ features • Fetch vs Axios • REST APIs vs GraphQL • LocalStorage vs SessionStorage vs Cookies ✨ Extra practice alongside this list: – Writing polyfills (bind, map, reduce) – Solving real interview & machine-coding questions – Explaining answers out loud (this matters more than people think) If you’re revising JavaScript for interviews too 👇 What concepts would you add to this list? 👉 Follow Satyam Raj for more real interview insights, React fundamentals, and practical frontend engineering content. #JavaScript #FrontendDevelopment #InterviewPreparation #JSInterview #WebDevelopment #ReactJS #LearningInPublic #Developers #CodingLife #CareerGrowth
To view or add a comment, sign in
-
🔥 10 Advanced JavaScript Concepts - You Can’t Miss for Frontend Interviews Here are the top 10 Advance Concepts 1️⃣ Event Loop & Task Queues 👉 Call stack, microtasks vs macrotasks, Promise.then, queueMicrotask 2️⃣ Execution Context & Scope Chain 👉 Hoisting, Temporal Dead Zone, global vs function execution context 3️⃣ Prototypal Inheritance & Prototype Chain 👉 Method lookup, prototype vs __proto__ 4️⃣ Observers API (Must-Know) 👉 IntersectionObserver, MutationObserver, ResizeObserver, PerformanceObserver 5️⃣ AbortController & AbortSignal 👉 Cancel fetch requests, cleanup async operations 6️⃣ Web Workers & Shared Workers 👉 Multithreading, off-main-thread computation 7️⃣ Proxy & Reflect APIs 👉 Interception, validation, state reactivity patterns 8️⃣ Memory Management & Garbage Collection 👉 Memory leaks, WeakMap / WeakSet, profiling 9️⃣ Custom Event System 👉 EventTarget, CustomEvent, pub-sub patterns 🔟 Debouncing vs Throttling (Implementation) 👉 Optimizing scroll, resize, and input events --- ✅ Checkout FrontendGeek.com to prepare for all rounds of Frontend Interviews 🔥 Follow Anuj Sharma & FrontendGeek for all about Frontend - Interview Tips, Development & jobs #frontend #interview #FrontendInterview #MachineCoding #javascript #js #react #patterns #frontendtech #FrontendGeek
To view or add a comment, sign in
-
-
Interview Question: What is a Closure in JavaScript? - A closure is created when a function remembers and accesses variables from its outer (lexical) scope, even after the outer function has finished executing. In simple words: A function + its outer scope = Closure ● Example of Closure : function outer() { let count = 0; function inner() { count++; console.log(count); } return inner; } const fn = outer(); fn(); // 1 fn(); // 2 -> inner() remembers count even after outer() is done. ● Why Closures are Useful? - Data hiding / encapsulation - Maintaining state - Callback functions - Event handlers • Interview Tip: Closures are possible because JavaScript uses lexical scoping, not dynamic scoping. #JavaScript #InterviewPrep #Closures #WebDevelopment #Frontend #MERN #LearnInPublic #CodingJourney #Backend #30DaysOfJavaScript #Backend #BDRM #BackendDevWithRahulMaheshwari
To view or add a comment, sign in
-
-
🚀 Recent Interview Experience – Most Asked JavaScript Questions If you’re preparing for a Frontend / JavaScript interview, these questions came up multiple times 👇 🟨 JavaScript Core Concepts 1️⃣ Difference between var, let, and const 2️⃣ Hoisting in JavaScript 3️⃣ What are Closures? 4️⃣ Event Delegation and its use cases 5️⃣ == vs === 6️⃣ call, apply, bind 7️⃣ How does the Event Loop work? 8️⃣ Promises vs async/await 9️⃣ Debounce vs Throttle 🔟 Shallow copy vs Deep copy 👉 Follow NURSID ANSARI for upcomming post on: #JavaScript #FrontendDeveloper #WebDevelopment #InterviewPrep #ReactJS
To view or add a comment, sign in
-
🧠 What happens before JavaScript executes? Before your JavaScript code runs, the engine parses it, creates the execution context, allocates memory, hoists variables/functions, and prepares optimized code using JIT compilation. This explains hoisting, the temporal dead zone, and many tricky JS behaviors — and it’s a must-know concept for JavaScript interviews, especially for frontend and full-stack roles. 📘 I’ve written a detailed article on this topic on Medium — link shared in the comments. #JavaScript #Interviews #WebDevelopment #Frontend #Engineering
To view or add a comment, sign in
-
-
🔥 Hot Interview Questions – Part 3 JavaScript Code, Output & Tricky Questions (UI / React Devs) Let’s test real JavaScript understanding 👇 1️⃣ What will be the output? console.log(typeof null); 2️⃣ Predict the output: let a = 10; function test() { console.log(a); let a = 20; } test(); 3️⃣ Output? for (var i = 0; i < 3; i++) { setTimeout(() => console.log(i), 0); } 4️⃣ What is the difference between: [] == [] {} == {} 5️⃣ What will this return? Promise.resolve(1) .then(x => x + 1) .then(x => { throw x }) .catch(x => x + 10) .then(x => console.log(x)); 💡 If you can explain why, you’re interview-ready. 👉 Save for practice 👉 Share with JS learners #JavaScript #CodeChallenge #FrontendInterview #ReactJS #WebDevelopers
To view or add a comment, sign in
Explore related topics
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