Arrow vs Regular Function in Objects ⚡ in JavaScript 🔄 | What’s the Log? | What’s the Log? 54

Опубликовано: 13 Июнь 2026
на канале: Web & Beyond
1,163
15

Arrow functions behave differently than regular functions when it comes to this.

Explanation:
regular → uses this from the object → prints 42.
arrow → no own this, inherits from outer scope (undefined in strict mode).

✅ Key Takeaways:
Arrow functions don’t bind their own this.
Regular functions get this from the caller object.
Use arrows for callbacks, regular functions for object methods.

✨ Support the channel
☕ Buy me a coffee → https://buymeacoffee.com/webnbeyond
🇮🇳 For Indian viewers → UPI: wnb26@ptyes
(Helps me create more free content 🙌)

🌐 Need hosting? 💰 Use this link to get 20% EXTRA discount 🎉
Get fast & affordable hosting → https://shorturl.at/7Ej1K

📦 Developer Essentials:
👓 Protect your eyes → https://amzn.to/4mHta4I
💻 Keep your laptop cool → https://amzn.to/45obqpm
📝 Quick reminder tool → https://amzn.to/3UzgukA
📚 Full list of books & gear I recommend → https://rebrand.ly/9yiqge6

⚠️ Disclaimer: These links are affiliate links—I may earn a small commission at no extra cost to you.

#javascript #whatsTheLog #codingshorts #codingchallenge #learnjavascript #webdevelopment #javascripttips