🧠 ArrayBuffer — the real memory behind JavaScript Ever wondered how JavaScript handles raw binary data? That’s where ArrayBuffer comes in 👀 (Check the image 👇) 🔹 What is an ArrayBuffer? A fixed-size block of raw memory Stores data as bytes Has no type (just memory) 👉 Think of it as pure memory, not an array. 🔹 Where is it stored? Allocated in the JavaScript heap Managed by the JS engine (V8, etc.) JS only keeps a reference, not the data itself 🔹 How do we read/write data? Using TypedArrays (Uint8Array, Int16Array, etc.) They decide how bytes are interpreted. 🔹 Important limits ⚠️ Max size ≈ 2GB per ArrayBuffer Size is fixed (cannot grow) Large buffers should be handled in chunks 🔹 Where it’s used in real life You’re already using it in: File uploads Fetch & Streams WebSockets Audio / Video Canvas WebAssembly Node.js Buffer (built on top of ArrayBuffer) 🔑 One-line takeaway If you understand ArrayBuffer, you understand how JavaScript talks to memory. If this helped, 👍 like or 💬 comment More JS internals explained simply coming soon 🚀 #JavaScript #JSInternals #ArrayBuffer #TypedArray #WebDevelopment #FrontendDevelopment #BackendDevelopment #NodeJS #BrowserAPIs #LearningInPublic #DeveloperCommunity #ProgrammingTips
Understanding JavaScript's ArrayBuffer and TypedArrays
More Relevant Posts
-
The Truth Behind JavaScript’s Oldest “Bug” 🐞 Ever felt like JavaScript was gaslighting you? 😅 typeof null === "object" has confused developers for decades. It’s often called a 30-year-old bug—but technically, it’s a legacy behavior preserved for backward compatibility. What actually happened? In the first implementation of JavaScript, values were represented as a combination of two parts, a type tag(The first 3 bits) and an actual value(with the remaining bits). The type tag for objects was 0. And null was represented as the NULL pointer which is nothing but all zeros. The JS engine saw those 3 first zeros of null and misclassified it as an object! It was a simple storage mistake. Once the web depended on it, fixing it would’ve broken the internet. So the JS team made a deliberate choice: don’t fix it. 📚 References: • MDN Web Docs: https://lnkd.in/gqAB6zJ5 • TC39 discussions: https://lnkd.in/gU3aRR3r • 2ality deep dive: https://lnkd.in/gX_qDZyz 🛡️ Safe pattern: if (data !== null && typeof data === "object") { ... } JavaScript didn’t lie to you—it just has a very long memory 😄 #JavaScript #WebDevelopment #SoftwareEngineering #ProgrammingHumor
To view or add a comment, sign in
-
-
🧠 TypedArray = Bridge between JavaScript Memory and Real World I’ve been exploring how binary data moves: 👉 From memory 👉 Through TypedArrays 👉 Into Buffers 👉 And finally over the network 🔹 What I practiced Created an ArrayBuffer Attached a Uint8Array (TypedArray) Filled it with ASCII values Sent the same memory directly in an HTTP response No strings. No JSON. Pure bytes. 🔹 Why TypedArrays matter TypedArrays decide how bytes are interpreted: Uint8Array → unsigned bytes Int16Array → signed 16-bit integers Float32Array → floating numbers They turn raw memory into meaningful data. 🔹 Memory → Disk → Network (Same Concept) The same ArrayBuffer can be: ✅ Written to a file ✅ Sent over HTTP ✅ Stored in a database ✅ Processed in WebAssembly Without changing the underlying memory. 🔹 Important insight Node.js Buffer is built on top of ArrayBuffer + TypedArray. So when you understand TypedArrays, you understand how Node.js handles binary data internally. 🔑 One-Line Takeaway TypedArrays are the highway that moves bytes between memory, disk, and network. If this kind of low-level JS excites you, 👍 like or 💬 comment More JavaScript internals & experiments coming soon 🚀 #JavaScript #TypedArray #ArrayBuffer #NodeJS #JSInternals #BinaryData #WebDevelopment #BackendDevelopment #LearningInPublic #DeveloperCommunity
To view or add a comment, sign in
-
-
🧠 99% of JavaScript developers answer this too fast — and get it wrong 👀 (Even with 2–5+ years of experience) ❌ No frameworks ❌ No libraries ❌ No async tricks Just pure JavaScript fundamentals. 🧩 Output-Based Question (Objects & References) const a = { x: 1 }; const b = a; b.x = 2; console.log(a.x); ❓ What will be printed? ❌ Don’t run the code 🧠 Think like the JavaScript engine A. 1 B. 2 C. undefined D. Throws an error 👇 Drop ONE option only (no explanations yet 😄) 🤔 Why this matters Most developers assume: const makes data immutable assigning creates a copy objects behave like primitives All three assumptions are dangerous. This question tests: • reference vs value • memory behavior • how objects are stored • what const actually protects When fundamentals aren’t clear: state mutates unexpectedly React bugs appear out of nowhere data leaks across components debugging becomes guesswork Strong JavaScript developers don’t just write code. They understand what lives in memory. 💡 I’ll pin the explanation after a few answers. #JavaScript #JSFundamentals #WebDevelopment #FrontendDeveloper #FullStackDeveloper #CodingInterview #DevCommunity #ProgrammingTips #LearnJavaScript #SoftwareEngineering
To view or add a comment, sign in
-
-
The Journey of an Embedded Object in JavaScript (Recursion in Action) Today I explored a simple but powerful concept in JavaScript: traversing nested objects using recursion. When working with deeply embedded objects (like API responses or application state), it’s important to understand how to navigate through multiple levels dynamically. 💡 What’s happening? We loop through each key in the object. If the value is another object → we call the function again (recursion). If it’s a primitive value → we print it. This is a Depth-First Search (DFS) approach applied to objects. This concept is extremely useful for: Parsing JSON responses Building form validators State inspection (NgRx / Redux) Creating flatten utilities Deep comparison algorithms 📂 I’ve added more JavaScript pattern exercises in this repository: 👉 https://lnkd.in/ej4fNeZs I’m currently strengthening my fundamentals in JavaScript, recursion, and problem-solving patterns. If you're also sharpening your JS skills, let’s connect and grow together 💪 #JavaScript #Recursion #WebDevelopment #Frontend #ProblemSolving #LearningInPublic
To view or add a comment, sign in
-
-
🧠 99% of JavaScript devs fall into this trap 👀 (Even with years of experience) No frameworks. No libraries. Just core JavaScript fundamentals. 🧩 Output-Based Question (parseInt + map) console.log(["1", "2", "3"].map(parseInt)); ❓ What will be printed? ❌ Don’t run the code 🧠 Think like the JavaScript engine A. [1, 2, 3] B. [1, NaN, NaN] C. [1, 2, NaN] D. Throws an error 👇 Drop ONE option in the comments Why this matters Most developers assume: parseInt only takes one argument map passes only the value Both assumptions are wrong. When fundamentals aren’t clear: bugs slip into production data parsing breaks silently debugging turns into guesswork Strong JavaScript developers don’t guess. They understand how functions are actually called. 💡 I’ll pin the full explanation after a few answers. #JavaScript #JSFundamentals #CodingInterview #WebDevelopment #FrontendDeveloper #FullStackDeveloper #DevelopersOfLinkedIn #DevCommunity #JavaScriptTricks #VibeCode
To view or add a comment, sign in
-
-
Today I explored one of the most powerful and widely used concepts in JavaScript: Higher-Order Functions, along with the map, filter, and reduce array methods. Understanding higher-order functions helped me see how functions in JavaScript can be passed as arguments, returned from other functions, and used to write cleaner, more expressive code. The map, filter, and reduce methods showed how complex data transformations can be handled in a functional and readable way. What I learned: How higher-order functions enable reusable and composable logic Using map() to transform data without mutating the original array Using filter() to extract specific data based on conditions Using reduce() to accumulate values and solve complex problems in a single pass 💡 Key takeaway: These methods shift the focus from how to loop to what to compute, making code more declarative, readable, and maintainable. This session strengthened my ability to work with data efficiently and write cleaner JavaScript that scales well in real-world applications. #JavaScript #HigherOrderFunctions #MapFilterReduce #FunctionalProgramming #WebDevelopment #LearningJourney
To view or add a comment, sign in
-
Day-36 | JavaScript Objects 🧠 Today, I learned about Objects in JavaScript, a core concept used to store and manage related data in a structured way. Objects allow us to represent real-world entities by grouping values under meaningful names. I explored: • What an Object is and why it exists • How data is stored as key–value pairs • Different ways to access object properties • How objects can hold values like numbers, strings, arrays, and even functions • Why objects are the foundation of real-world JavaScript applications Understanding objects changed how I look at data — it’s no longer just variables, but organized information with behavior. This concept is essential for building scalable applications and writing clean, readable code. On to Day-37 👉 #BuildInPublic #JavaScript #WebDevelopment #LearningInPublic #Frontend #Objects #DeveloperJourney #Consistency
To view or add a comment, sign in
-
-
🌙 Evening Post — Why This if Block Always Runs This morning’s code was: let a = []; if (a) { console.log("Yes"); } else { console.log("No"); } 💡 Correct Output Yes This surprises many people 😄 Let’s understand why step by step. 🧠 Simple Explanation : 🔹 Key Rule in JavaScript 👉 In JavaScript, all objects are truthy. And: [] // is an object Even though the array is empty, it still exists in memory. So JavaScript treats it as: true 🔹 What happens in the if condition? if (a) Here: a is [] [] is truthy So the if block runs 👇 console.log("Yes"); That’s why the output is: Yes ❗ Common Mistake Beginners Make Many people think: Empty array [] → falsy ❌ Empty object {} → falsy ❌ But actually: [] → truthy ✅ {} → truthy ✅ Only these are falsy in JS: false 0 "" (empty string) null undefined NaN 🎯 Key Takeaways : Empty arrays are truthy Empty objects are truthy Truthy/falsy is about type, not size This question appears often in interviews 📌 If you want to check if an array is empty, do this instead: a.length === 0 💬 Your Turn Did you expect "Yes" or "No"? 😄 Comment “Got confused 😅” or “Clear now ✅” #JavaScript #LearnJS #FrontendDevelopment #CodingInterview #Basics #TechWithVeera #WebDevelopment
To view or add a comment, sign in
-
-
📘 Day 65: JavaScript Arrays & Powerful Array Methods 🔹 Array Basics: • Similar to lists — store multiple values in one variable • Can hold different datatypes • Mutable, ordered, and allow duplicates • Written inside square brackets [ ] 🔹 Concat: • Combines multiple arrays • Keeps duplicate values 🔹 Spread Operator (...): • Modern way to merge arrays • Cleaner and more flexible than concat • Very important in real projects 🔹 Push & Pop: • push() → adds items to the end • pop() → removes last item 🔹 Shift & Unshift: • shift() → removes first item • unshift() → adds item at the start 🔹 Join: • Converts array into string • Separator can be customized 🔹 Sort: • Sorts alphabetically or numerically • Numbers are sorted before strings 🔹 Slice: • Extracts part of an array • Doesn’t change original array • Supports negative indexing 🔹 Splice (Important): • Insert, replace, or delete elements • Changes original array • Uses position, delete count, and new values 💡 Practiced how arrays make data handling easier and how these methods help in real-world JavaScript development. #Day65 #JavaScript #WebDevelopment #CodingJourney #FrontendDevelopment #LearningJavaScript #Arrays #JSBasics
To view or add a comment, sign in
-
💡 The Call Stack tracks execution. ❓ What causes a stack overflow error? The call stack is like a to-do list for JavaScript. Every time a function runs, it gets added (pushed) to the stack. When it finishes, it gets removed (popped). 👉 A stack overflow error happens when too many functions are added to the stack and it runs out of space. 🔹 Most Common Cause: Infinite Recursion function loop() { loop(); // calling itself forever } loop(); // ❌ Maximum call stack size exceeded Here, loop() keeps calling itself without stopping. Each call adds a new frame to the stack, and eventually the stack becomes full. 🔹 Proper Recursion (with base case) function countDown(n) { if (n === 0) return; // base case countDown(n - 1); } countDown(5); // ✅ works fine The base case stops the recursion and prevents overflow. ⚠️ Other Causes Deep nested function calls Large recursive algorithms without limits Circular function calls 💡 Takeaway A stack overflow happens when functions keep stacking up without finishing. Always make sure recursive functions have a clear stopping condition. #learnwithisnaan #JavaScriptTips #ModernJavaScript #ES6 #DeveloperTips #CleanCode #JSDevelopers
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