The `this` keyword in JavaScript — explained simply 🧠 `this` confuses many developers at first. The key is: it depends on HOW a function is called. Normal Function 👇 • `this` refers to the object that calls the function • Value is dynamic Arrow Function 👇 • `this` does NOT have its own context • It takes `this` from the parent scope Simple rule to remember: Normal function → its own `this` Arrow function → borrows `this` This is why arrow functions are commonly used in: ✔ Callbacks ✔ React components ✔ Event handlers (carefully) Once this clicks, many bugs disappear 🚀 #javascript #frontenddeveloper #webdevelopment #coding #learningjavascript #reactjs #softwareengineering
Understanding `this` in JavaScript: Normal vs Arrow Functions
More Relevant Posts
-
null vs undefined in JavaScript 🧠 These two confuse almost every beginner. But the difference is actually simple. undefined 👇 • JavaScript assigns it automatically • Variable is declared but not given a value • Means “value not available yet” null 👇 • Assigned intentionally by the developer • Means “empty on purpose” • Used to clear or reset a value Simple way to remember: undefined → JS did it null → YOU did it Understanding this helps avoid unexpected bugs and confusion in real projects 🚀 #javascript #frontenddeveloper #webdevelopment #coding #learningjavascript #reactjs #softwareengineering
To view or add a comment, sign in
-
-
JavaScript Hoisting — explained simply 🧠⬆️ Hoisting is one of the most confusing JavaScript topics, but the idea is actually very simple. Before executing code, JavaScript: ✔ Scans the file ✔ Allocates memory for variables and functions Important points: • Function declarations are fully hoisted • var is hoisted but initialized as undefined • let & const are hoisted but not accessible (TDZ) Simple rule to remember: Hoisting moves declarations to the top, not values. Understanding hoisting helps avoid “undefined” and reference errors 🚀 #javascript #frontenddeveloper #webdevelopment #coding #learningjavascript #reactjs #softwareengineering
To view or add a comment, sign in
-
-
Most devs get this wrong 👀 No frameworks. No libraries. No async tricks. Just pure JavaScript fundamentals. Question 👇 const user = { name: "JS" }; Object.freeze(user); user.name = "React"; console.log(user.name); ❓ What will this log? A. "React" B. "JS" C. undefined D. Throws an error Why this matters Many developers believe Object.freeze() protects objects from all changes. It doesn’t. It prevents mutation — but it does NOT throw an error in non-strict mode. When fundamentals aren’t clear: bugs slip into production silently debugging becomes guesswork confidence in code drops Strong developers don’t just use features. They understand how JavaScript actually behaves. Drop your answer in the comments 👇 Did this one surprise you? #JavaScript #JSFundamentals #WebDevelopment #FrontendDeveloper #FullStackDeveloper #DevelopersOfLinkedIn #CodingInterview #Programming #DevCommunity #LearnJavaScript #VibeCode
To view or add a comment, sign in
-
-
🚀 Day 880 of #900DaysOfCode ✨ Rest vs Spread Operator in JavaScript The rest and spread operators look identical in syntax, yet they solve two very different problems in JavaScript — and that’s where many developers get confused. In today’s post, I’ve clearly explained how rest and spread operators work, why they exist, and when to use each one in real-world JavaScript scenarios. The explanation is kept simple, practical, and easy to remember, so you don’t mix them up again. If you want to write cleaner functions and handle data more confidently, this post is for you. 👇 Which one confused you the most earlier — rest or spread? Let me know in the comments! #Day880 #learningoftheday #900daysofcodingchallenge #FrontendDevelopment #WebDevelopment #JavaScript #React #CodingCommunity #ES6 #FrontendDevelopment
To view or add a comment, sign in
-
🚀 Day 860 of #900DaysOfCode ✨ 7 Weird Things in JavaScript 👀 JavaScript is powerful… but let’s be honest — it can also be wonderfully weird. And understanding those “what just happened?” moments is exactly what helps you write more predictable, bug-free code. In today’s post, I’ve shared 7 strange, surprising, and often confusing behaviors in JavaScript — explained in a simple and intuitive way so you can finally make sense of them. Whether you're a beginner or an experienced dev, these insights will strengthen the way you think about JS under the hood. 👇 Which JS “weird behavior” surprised you the most when you first learned it? Tell me in the comments! #Day860 #learningoftheday #900daysofcodingchallenge #FrontendDevelopment #WebDevelopment #JavaScript #React #CodingCommunity #WTFJS #WebDevelopment #LearnJavaScript
To view or add a comment, sign in
-
JavaScript: Fetch API, Promises & Async/Await 🌐⚙️ These concepts are must-know for handling API calls and async operations in modern JavaScript. 🔹 Fetch API Used to make HTTP requests. It returns a Promise. 🔹 Promises Handle async results with 3 states: pending → resolved → rejected 🔹 Async/Await A cleaner and more readable way to work with Promises using try/catch. 🧠 Practice Tip: ✔ Fetch data from a public API ✔ Rewrite it using async/await ✔ Handle errors properly Save this if you’re learning JavaScript 🚀 #JavaScript #WebDevelopment #AsyncJavaScript #FetchAPI #FrontendDevelopment #LearnToCode #DevTips
To view or add a comment, sign in
-
-
`𝗳𝗼𝗿𝗘𝗮𝗰𝗵` 𝗹𝗼𝗼𝗸𝘀 𝗶𝗻𝗻𝗼𝗰𝗲𝗻𝘁. 𝗨𝗻𝘁𝗶𝗹 𝘆𝗼𝘂 𝗺𝗶𝘅 𝗶𝘁 𝘄𝗶𝘁𝗵 𝗮𝘀𝘆𝗻𝗰 𝗰𝗼𝗱𝗲. Many async bugs don’t throw errors. They just quietly do the wrong thing. `forEach` doesn’t wait. It doesn’t respect `await`. So your logic runs out of order while your code 𝗹𝗼𝗼𝗸𝘀 correct. This is one of those traps that separates “working code” from 𝗿𝗲𝗹𝗶𝗮𝗯𝗹𝗲 𝗰𝗼𝗱𝗲. If you write async JavaScript, this is worth a pause. 𝗥𝗲𝗮𝗱 𝗺𝗼𝗿𝗲: https://lnkd.in/dww_BYP2 #JavaScript #AsyncProgramming #CleanCode #WebDevelopment #DeveloperMindset
To view or add a comment, sign in
-
🧠 Shortcuts don’t break JavaScript. Misunderstanding fundamentals does. I tried using throw new Error() inside a ternary operator, expecting it to behave like an if/else. ❌ Didn’t work. 🧠 The reason (important): • throw is a statement, not an expression • Ternary operators only accept expressions Small syntax rule. Big “aha” moment. 💡 What this reinforces: ✔️ Fundamentals matter more than clever tricks ✔️ JavaScript rewards clarity over shortcuts ✔️ Tiny misunderstandings can cause long debugging sessions These are the kinds of details that separate code that runs from code that’s reliable. 👀 Your turn: What’s the smallest JavaScript mistake that once wasted the most time for you? 💬 Drop it in the comments let’s learn from each other. 📩 And if you’re building or reviewing a Node.js/JavaScript codebase and want it clean, predictable, and production-ready feel free to DM me. #JavaScript #NodeJS #WebDevelopment #SoftwareEngineering #CodingLife #DeveloperLearning #CleanCode #Debugging #ProgrammingTips #TechCommunity #BuildInPublic
To view or add a comment, sign in
-
-
💠 JavaScript slice() Method — Explained Simply The slice() method is used to extract a portion of an array or string without modifying the original data. It returns a new array or string, making it a non-mutating and safe operation. 🔍 Key Characteristics 🔸 Does not mutate the original array or string 🔸 Supports negative indexes 🔸 Commonly used for copying arrays, pagination, and sub-list creation 👉 Real-World Use Case 🔹 In React applications, slice() is often used for: 🔹 Pagination 🔹 Displaying partial lists 🔹 Maintaining immutability during state updates 💡 Why it matters 🔹 In React and modern JavaScript, immutability is key. 🔹 slice() helps maintain clean, predictable state updates. #JavaScript #FrontendDevelopment #ReactJS #WebDevelopment #CodingTips #LearnJavaScript #Programming
To view or add a comment, sign in
-
-
🚀 Day 888 of #900DaysOfCode ✨ Mastering Promises in JavaScript Asynchronous code is at the heart of modern JavaScript — and Promises are what make it manageable. In today’s post, I’ve shared a clear and practical guide to mastering Promises in JavaScript, helping you understand how async flows actually work behind the scenes. This post is designed to make promises feel less confusing and more predictable. If you want to write cleaner async code and feel confident while handling API calls, this one is for you. 👇 What’s the trickiest part of working with Promises for you? Drop your thoughts in the comments! #Day888 #learningoftheday #900daysofcodingchallenge #FrontendDevelopment #WebDevelopment #JavaScript #React #CodingCommunity #Promises #AsyncJavaScript
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