😵 This one line in JavaScript can trick you! let a = 10; let b = a++; console.log("Addition", a + b, "a = ", a, "b = ", b) At first glance, you might expect both values to be the same… right? 🤔 But JavaScript has its own way of handling this. 👉 Why does b get 10 instead of 11? 👉 When exactly does the increment happen? 👉 And how is this different from ++a? This small concept can lead to big bugs if you misunderstand it. I’ve broken it down clearly in my latest video 🎥 Watch it once — you’ll never get confused again. #JavaScript #Frontend #WebDevelopment #Coding #LearnJavaScript
More Relevant Posts
-
💡 JavaScript Tricky Question let a = 'hello'; a[0] = 'H'; console.log(a); 👉 Output: `hello` ✅ Explanation: Strings in JavaScript are **immutable** (cannot be changed). Even though it looks like we’re modifying `a[0]`, JavaScript ignores it. So the original string stays the same. 🔹 To change it, you must create a new string: a = 'H' + a.slice(1); #JavaScript #WebDevelopment #Frontend #Coding #JSConcepts
To view or add a comment, sign in
-
Hey network! 👋 I’ve been diving into learning JavaScript recently and wanted to share my latest practice project: a classic Simon Says Game! 🎮 Building this was a fantastic way to get hands-on experience with Vanilla JS, specifically focusing on DOM manipulation, event handling, and sequence logic. It was a fun challenge keeping track of the memory arrays and user inputs! 💻 Check out the code here: https://lnkd.in/gwGmr_37 🔗 Let's connect: https://lnkd.in/gtzKeBxq Thoughts and feedback are always welcome! #JavaScript #WebDevelopment #Frontend #CodingJourney #LearningToCode #Projects
To view or add a comment, sign in
-
JS Pop Quiz: Did we just overwrite the Admin?! Let’s see who really understands JavaScript memory allocation! 👨💻👩💻 Look at the code snippet from @codewithsarir. We have a user1 object. We assign it to user2, and then change user2's role to 'Guest'. Question: What does console.log(user1.role) actually print? A) 'Admin' (Because we only changed user2) B) 'Guest' (Because they share the same reference) C) undefined D) It throws a TypeError Hint: Think about how JavaScript handles Objects versus Primitive types like strings. Does = make a copy, or just point to the same address? 🤔 Drop your guess in the comments before you test it in your IDE! 👇 Hashtags: #JavaScript #CodingQuiz #WebDesign #ProgrammerLife #Developers #LearnToCode #JS #Frontend #creators #codinglife #programmer
To view or add a comment, sign in
-
-
JavaScript is simple… until it isn’t 😅 Here are a few things that confused me (and probably you too): 👉 [] + [] = "" 👉 [] + {} = "[object Object]" 👉 {} + [] = 0 And the classic: 👉 typeof null === "object" 🤯 JavaScript isn’t weird… it’s just misunderstood. Once you understand type coercion, execution context, and closures, everything starts making sense. 💡 My advice: Don’t just “use” JavaScript — understand how it works internally. What’s the most confusing JS behavior you’ve faced? 👇 #javascript #webdevelopment #frontend #programming
To view or add a comment, sign in
-
Built a little browser game over the weekend using just vanilla JavaScript. No frameworks, no libraries — one HTML file. Move your cursor to destroy enemies, survive boss waves, grab power-ups. Runs at 60fps with particle effects and procedural audio. Sometimes the best way to sharpen your skills is to build something fun. Try it: https://lnkd.in/gQGEcv-v #JavaScript #WebDev #CreativeCoding
To view or add a comment, sign in
-
-
If you think semicolons don’t matter in JavaScript…? Click “more” before you scroll ... Skipping semicolons feels harmless… 👀 Until this happens 👇 const arr = [1, 2, 3] (function () { console.log("Hello 👋") })() 👉 Error: arr is not a function 😳 👉 Why? JavaScript thinks you're calling the array as a function Because there’s no semicolon before the IIFE 👉 Fix: const arr = [1, 2, 3]; 👉 Small symbol… big problem 😬 This is due to Automatic Semicolon Insertion (ASI) ⚡ Follow for more simple dev concepts 🚀 #JavaScript #Developers #WebDevelopment #Coding #Debugging #Relatable
To view or add a comment, sign in
-
-
JavaScript Brain Teaser: The this Trap... Looks simple… but there’s a catch hiding in plain sight const obj = { name: "Deepak", first: function () { console.log("First:", this.name); }, second: () => { console.log("Second:", this.name); } }; obj.first(); obj.second(); Drop your answers in the comments Let’s see who truly understands what’s happening under the hood #JavaScript #CodingChallenge #Frontend #InterviewPrep #WebDevelopment
To view or add a comment, sign in
-
A few years back… I thought all functions are hoisted the same way 😅 But actually… only one type gets VIP access 😅 👉 Function declaration → fully hoisted ✅ 👉 Function expression → hoisted as undefined ❌ 👉 Arrow function → same as above ❌ So this works 👇 sayHello() But these crash 👇 sayHi() sayBye() Because JavaScript treats them like variables first… and functions later 🤯 🔥 Rule: Only function declarations are safe to call before definition What’s the most confusing hoisting example you’ve seen? 😅 👉 var vs let? 👉 functions vs arrow functions? 👉 something weird in real project? Drop it in comments — let’s confuse everyone together 😂 #javascript #webdev #frontend #codingtips #developer
To view or add a comment, sign in
-
-
I recently took some time to deeply understand three core JavaScript concepts that often confuse developers: Scope, Hoisting, and Closures. Instead of just memorizing, I wanted to truly understand how and why they work — so I broke everything down with simple explanations and practical examples. 📌 In this article, I covered: The real meaning of Scope (Global, Function, Block, Lexical) What actually happens during Hoisting How Closures work and why they’re so powerful in JavaScript I also connected all three concepts together — because once you see how they relate, things become much clearer 🔥 🔗 Check out the full article: https://lnkd.in/gT6dmXr3 I’d really appreciate your feedback and thoughts 🙌 #javascript #webdevelopment #frontend #programming #closure #hoisting #scope #developers
To view or add a comment, sign in
-
-
"I’m just going to say it: JavaScript Promises are hard. 🙃 I thought I had a handle on asynchronous code, but then came .then(), .catch(), and the logic of resolve vs reject. It’s one of those topics where you think you’ve got it, and then one unhandled rejection reminds you that you don't. Learning to code isn't always 'eureka' moments; sometimes it's just sitting with the frustration until it clicks. To my fellow devs—what was the one JS concept that finally made the lightbulb go off for you? #Javascript #WebDevelopment #CodingLife #LearnToCode"
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