JavaScript Array Length Property Behavior

👀 This JavaScript Code Looks Normal… But the Output Isn’t Most people read this and say: “easy” But many get the output wrong 👀 CODE : let arr = [1, 2, 3]; console.log(arr.length); arr.length = 0; console.log(arr); console.log(arr.length); No loops. No functions. Just one property: length. Still… this surprises a lot of developers 🧠 Why this question matters Helps you understand how arrays really work Shows that length is not just a number Very common interview + real debugging scenario Looks simple but tests real understanding 💬 Your Turn Comment your answers like this 👇 Line 1 → ? Line 2 → ? Line 3 → ? Try answering without running the code 🤓 I will post the correct output + simple explanation in the evening 📌 Note: This is to understand JavaScript behavior, not to encourage confusing code. #JavaScript #FrontendDevelopment #LearnJS #CodingInterview #TechWithVeera #WebDevelopment #100DaysOfCode

  • text

Line 1 → 3 Line 2 → [] Line 3 → 0

See more comments

To view or add a comment, sign in

Explore content categories