🚀 Day 25 - Poll answer & Explanation console.log([].length); // 0 console.log([,,,].length); // 3 Explanation: [] → empty array → no elements → length = 0 [,,,] → 3 empty slots (not values, just positions) JavaScript counts slots, not actual values → length = 3 #JavaScript #JSTricks #JSBasics #JSInterview #FrontendDev #WebDevelopment #Coding #Programming #Developer #CodeNewbie #LearnToCode #TrickyQuestions #InterviewPrep #DevTips #JavaScriptTips
JavaScript Array Length Explanation
More Relevant Posts
-
🚀 React Series - Day 2 How Data Flows in React (Props Explained Simply) In React, components often need to share data with each other. This is done using props - a way to pass information from a parent component to a child component. Props help make components dynamic and reusable. For example, the same component can display different data just by changing the props. One important rule: props are read-only. They can be used, but not modified inside the component. 👉 This keeps data flow predictable and easy to debug. #reactjs #javascript #frontenddeveloper #webdevelopment #codinginterview #learnreact #30daysofcode #programming #reactinterview #react #coding
To view or add a comment, sign in
-
In JavaScript, Reference Data Types say: “If you change me… I will change the every refrences of yours. 😏 Sounds dramatic? Look at this 👇 let a = [1, 2, 3, 4]; let b = a; b.pop(); console.log(a); console.log(b); comment down the output?? #javascript #coding #learntocode #programming #datatypes #learninginpublic
To view or add a comment, sign in
-
Mastering JavaScript Arrays Made Simple! Understanding JavaScript array methods is a game-changer. They help you write cleaner, more efficient code without relying on lengthy loops. The image below highlights essential array methods every developer should know-use it as a quick visual guide to level up your JavaScript skills. #JavaScript #WebDevelopment #Coding #Frontend #Programming #LearnToCode #JavaScriptDeveloper #JSArray #ArrayMethods #ArrayMap #ArrayFilter #ArrayReduce #ES6JavaScript #FrontendDevelopment #CodingTips
To view or add a comment, sign in
-
-
Most developers get this WRONG 😅 What will be the output? console.log(1); setTimeout(() => console.log(2), 0); Promise.resolve().then(() => console.log(3)); console.log(4); 👇 Drop your answer before checking Understanding Event Loop = Next Level JavaScript 🚀 #JavaScript #CodingChallenge #FrontendDeveloper #TechCommunity #Programming #DevelopersIndia #LearnJS
To view or add a comment, sign in
-
-
The "this" Keyword: Predictable or a Trap? 🧐 Most devs think they understand this, until it returns undefined. Can you guess the output of this simple object? const obj = { a: 10, f: function () { return this.a; }, }; console.log(obj.f()); The answer seems easy... but do you know what happens to this if we change that function to an Arrow Function? 🤯 In my latest video, I break down exactly how execution context works so you never have to guess again. #JavaScript #WebDev #CodingTips #SoftwareEngineering #Programming
To view or add a comment, sign in
-
Understanding Sets, Maps, and Objects in JavaScript: When and How to Use Each Learn the differences between JavaScript's Set, Map, and plain Object data structures, their performance characteristics, and real‑world use cases. This tutorial walks you through practical examples, best practices, and guidelines for choosing the right structure for your code. Read the full article 👇 https://lnkd.in/gpUYsFux #JavaScript #WebDevelopment #Programming #Tech #Coding #JavaScriptSet #JavaScriptMap #DataStructures #FrontendDevelopment #JSBestPractices #DigitalTransformation #FutureOfWork
To view or add a comment, sign in
-
-
Ever wondered why JavaScript shows “undefined” even before a variable is assigned? 🤯 console.log(a); var a = 10; At first glance, this feels confusing… But the answer lies in one powerful concept: 👉 Execution Context Here’s what actually happens behind the scenes: ⚡ When JavaScript runs your code, it creates an Execution Context ⚡ In the memory phase, variables are hoisted → initialized as undefined ⚡ In the execution phase, code runs line by line and values get assigned I made a short video explaining the basics—would love your feedback 🙌 #javascript #webdevelopment #frontend #programming #coding #developers #learntocode #100daysofcode
To view or add a comment, sign in
-
Came across a classic JavaScript interview question today! 💡 👉 Find the first repeating character in a string. 🔹 The trick is simple track characters as you iterate and return the first one you’ve already seen. 🧠 Key Insight: “Seen before? Return immediately.” — no need for nested loops or sorting. This approach gives an efficient O(n) solution 🚀 #JavaScript #CodingInterview #DSA #WebDevelopment #Programming #TechSkills #CareerGrowth
To view or add a comment, sign in
-
-
How TypeScript Compiles Your Code – Step by Step! Ever wondered what happens behind the scenes when you run tsc? TypeScript does a lot more than just adding types to JavaScript. It has a 5-stage compiler workflow that ensures your code is safe, structured, and ready to run. In this carousel, we’ll break down each stage: 1️⃣ Lexer – Converts your code into tokens 2️⃣ Parser – Builds the Abstract Syntax Tree (AST) 3️⃣ Binder – Tracks symbols, scopes, and flow nodes 4️⃣ Checker – Performs syntax and type checking 5️⃣ Emitter – Generates .js, .d.ts, and .map files Swipe through to see each stage visually, understand how TypeScript works under the hood, and get a glimpse of why it’s so powerful for developers! 💻 #TypeScript #WebDevelopment #Frontend #Programming #Developers #CodingTips #JavaScript
To view or add a comment, sign in
-
Just published a deep dive into how V8 handles arrays under the hood 🚀 Key takeaway: not all arrays are equal. Packed arrays (SMI/Double) and TypedArrays are highly optimized, while holey and mixed arrays introduce hidden performance costs due to extra checks and de-optimizations. If you're writing performance-critical JavaScript, these low-level details *matter more than you think*. I’ve also included a benchmark to see the differences yourself 👇 https://lnkd.in/gsxGFNZv #JavaScript #V8 #Performance #NodeJS #Programming
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