Proxy and Reflect

A Proxy object wraps another object and intercepts operations, like reading/writing properties and others, optionally handling them on its own, or transparently allowing the object to handle them. Proxies are used in many libraries and some browser frameworks. We’ll see many practical applications in this article. Proxy The syntax: let proxy = new Proxy(target, handler) target – is… Continue reading Proxy and Reflect

How JavaScript’s Proxy Object Works – Explained with Example Use Cases

What is a proxy? From merriam-webster: A proxy may refer to a person who is authorized to act for another or it may designate the function or authority of serving in another’s stead. So a proxy is nothing but a mediator that speaks or operates on behalf of the given party. In terms of programming, the… Continue reading How JavaScript’s Proxy Object Works – Explained with Example Use Cases

Understanding WeakMap and WeakSet Objects in JavaScript

In JavaScript, WeakMap and WeakSet are specialized objects that provide unique functionalities when it comes to storing key-value pairs and managing collections of unique values. They are similar to Map and Set objects, but with some key differences. In this article, we will explore WeakMap and WeakSet objects, their purpose, usage, and the benefits they… Continue reading Understanding WeakMap and WeakSet Objects in JavaScript

How to Use WeakMap and WeakSet in JavaScript

JavaScript offers a number of tools for organizing and managing data. And while developers often use widely recognized tools like Maps and Sets, they may often overlook certain other valuable resources. For example, are you familiar with WeakMap and WeakSet? They’re special tools in JavaScript that help store and manage data in unique ways. This… Continue reading How to Use WeakMap and WeakSet in JavaScript

WeakMap and WeakSet

As we know from the chapter Garbage collection, JavaScript engine keeps a value in memory while it is “reachable” and can potentially be used. For instance: let john = { name: “John” }; // the object can be accessed, john is the reference to it // overwrite the reference john = null; // the object will… Continue reading WeakMap and WeakSet

Working of Garbage Collection in JavaScript: Under the Hood

🗑️ What is garbage collection? Every program runs with a certain memory which it uses to store its variables, function declarations etc. but at some point those entities might not be used anymore by the program and unnecessary storage of it causes memory consumption, which makes the app run slower. This is why we need, Garbage… Continue reading Working of Garbage Collection in JavaScript: Under the Hood

JavaScript Memory Management: A Comprehensive Guide To Garbage Collection In JavaScript

Debugging Memory Leaks With Garbage Collection In JavaScript JavaScript without a doubt is the most popular language among developers due to its versatility and ease of use. However, one of the challenges of working with JavaScript is managing memory efficiently. As a dynamically typed language, JavaScript doesn’t require developers to manually allocate and deallocate memory.… Continue reading JavaScript Memory Management: A Comprehensive Guide To Garbage Collection In JavaScript

Memory management

Low-level languages like C, have manual memory management primitives such as malloc() and free(). In contrast, JavaScript automatically allocates memory when objects are created and frees it when they are not used anymore (garbage collection). This automaticity is a potential source of confusion: it can give developers the false impression that they don’t need to worry about memory… Continue reading Memory management

Understanding Garbage Collection in JavaScript: A Key to Efficient Memory Management

As we explore the constantly changing world of JavaScript, it’s important for developers to understand garbage collection a key part of managing memory that helps our applications run at their best. In this article, I’ll explain in simple terms how garbage collection in JavaScript works and offer useful advice on how to prevent memory leaks.… Continue reading Understanding Garbage Collection in JavaScript: A Key to Efficient Memory Management

Garbage collection in JS

Garbage collection is the process in JavaScript (and many other programming languages) that automatically manages memory by identifying and reclaiming memory that is no longer in use or referenced by the program. In other words, it automatically allocates memory when objects are created and frees it when objects are destroyed or not in use. In most… Continue reading Garbage collection in JS