This JavaScript question trips up even experienced developers. What's the output? 👇 const obj = { name: "Shivesh", greet: function() { console.log(this.name) }, greetArrow: () => { console.log(this.name) } } obj.greet() // ? obj.greetArrow() // ? Drop your answer in comments BEFORE scrolling! 👇 I'll reveal the explanation in the first comment! #JavaScript #Frontend #WebDevelopment #CodingInterview #JSInterview #ReactJS
JavaScript this keyword binding in arrow functions
More Relevant Posts
-
🚀 Question of the day - JavaScript Event Loop – Can You Predict the Output? console.log("1"); setTimeout(() => console.log("2"), 0); Promise.resolve() .then(() => { console.log("3"); setTimeout(() => console.log("4"), 0); }) .then(() => console.log("5")); console.log("6"); 🧠 What will be the output? Drop your answer in the comments before scrolling 👇 ✅ Follow Chinmay Kulkarni for more . #JavaScript #Frontend #WebDevelopment #AsyncJavaScript #EventLoop #CodingInterview #ReactJS #SoftwareEngineering #TechInterview #Developers #100DaysOfCode #Interview
To view or add a comment, sign in
-
🚀 Memoization (JavaScript) Memoization is an optimization technique used to speed up function calls by caching the results of expensive function calls and returning the cached result when the same inputs occur again. This can significantly improve performance, especially for functions that are called repeatedly with the same arguments. Memoization is often implemented using closures to store the cached results. It's a powerful technique for optimizing computationally intensive functions. #JavaScript #WebDev #Frontend #JS #professional #career #development
To view or add a comment, sign in
-
-
JavaScript has exactly 6 falsy values. Memorize them: 1. false 2. 0 3. "" (empty string) 4. null 5. undefined 6. NaN Everything else is truthy. even these: [] ✓ truthy {} ✓ truthy "0" ✓ truthy "false" ✓ truthy -1 ✓ truthy Understanding this helps avoid many logical bugs. #react #frontend #javascript
To view or add a comment, sign in
-
JavaScript Challenge for Developers What will be the output? '5' == 5 '5' === 5 Same input… but different results? Drop your answers in the comments #JavaScript #CodingChallenge #Frontend #Developers
To view or add a comment, sign in
-
🚀 The `setInterval()` Function (JavaScript) The `setInterval()` function repeatedly executes a function at a specified interval in milliseconds. It's essential to use `clearInterval()` to stop the interval when it's no longer needed to prevent memory leaks and unexpected behavior. `setInterval` can be useful for tasks like updating a clock or polling a server for updates. Careful consideration should be given to the interval duration to avoid performance issues. #JavaScript #WebDev #Frontend #JS #professional #career #development
To view or add a comment, sign in
-
-
💡React Tip: Why we use "htmlFor" instead of "for" When I started learning React, this confused me. 👉 HTML version: <label for="name">Name</label> <input type="text" id="name" /> 👉 React version: <label htmlFor="name">Name</label> <input type="text" id="name" /> 👉 Why? "for" is a reserved keyword in JavaScript. So React uses "htmlFor" instead. 👉 What it does? It links the label to the input field. Clicking "Name" will focus the input. ✔ Same behavior ✔ Better accessibility Small concept, but important. #ReactJS #JavaScript #Frontend #WebDevelopment
To view or add a comment, sign in
-
Angular vs React 🤔 Both are powerful… but built with different philosophies. 👉 Angular = Structure 👉 React = Flexibility There’s no “best” — only what fits your project. Here’s a simple comparison 👇 #Angular #React #Frontend #Developers #JavaScript #WebDevelopment
To view or add a comment, sign in
-
-
⚛️ React Performance Tip — useMemo for Faster Rendering 🚀 #ReactJS #FrontendDevelopment #WebPerformance #JavaScript #CodingTips #Developers #Tech #SlowApp #SpeedOptimization #WebOtimization #AppPerformance
To view or add a comment, sign in
-
-
🚀 After learning Front-End Development, the next step is mastering the right frameworks. Here are 5 must-learn frameworks: 🚀 React ⚡ Next.js 🔥 Angular 💡 Vue.js 🛠️ Svelte Learning these frameworks can help you build faster, scalable, and modern web applications. Which one are you learning next? 👇 #WebDevelopment #Frontend #JavaScript #Developers
To view or add a comment, sign in
-
-
🚫 null vs undefined in JavaScript — Still Confused? Let’s Fix It 👇 As a frontend developer, I used to think null and undefined were the same… until they broke my logic in production 😅 Let’s simplify it: 👉 undefined Means a variable has been declared but not assigned a value yet let name; console.log(name); // undefined 👉 null Means you intentionally assigned “no value” let user = null; ⚡ Key Differences: 🔹 undefined = default state (JS assigns it) 🔹 null = intentional absence (you assign it) 🤯 Fun Fact: null == undefined // true null === undefined // false Why? Because == checks value only, while === checks value + type 🚨 Real-world Tip: Always use === instead of == to avoid unexpected bugs. 💡 When to use what? ✔️ Use undefined → when something is not initialized ✔️ Use null → when you want to explicitly clear a value Understanding this small difference can save you from BIG debugging headaches 🧠💥 #JavaScript #FrontendDevelopment #WebDevelopment #CodingTips #ReactJS #Developers
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
Answer: obj.greet() // "Shivesh" ✅ obj.greetArrow() // undefined Arrow functions don't have their own 'this' — they inherit from lexical scope. How many got it right? 😊