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
Category: 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
Handle processing peaks in NestJS using Queues and monitor them— Ft. Redis and Bull
Queues can come in handy in smoothing out processing peaks for tasks which can take time to process or block the node.js event loop. Challenge Lets say we have an endpoint which processes some data, that takes more than a few seconds; it can be complex calculations, video processing, audio transcoding etc.. if multiple users… Continue reading Handle processing peaks in NestJS using Queues and monitor them— Ft. Redis and Bull
Client Script to Validate Item Type Before Adding to Item Sublist
/** * @NApiVersion 2.0 * @NScriptType ClientScript * @NModuleScope SameAccount */ define([‘N/currentRecord’, ‘N/record’], /** * @param {currentRecord} currentRecord * @param {record} record */ function (currentRecord, record) { /** * Validation function to be executed when sublist line is committed. * * @param {Object} scriptContext * @param {Record} scriptContext.currentRecord – Current form record * @param {string}… Continue reading Client Script to Validate Item Type Before Adding to Item Sublist
Client Script for Extracting Values from URL
function setContactForm(type) { try { // Corrected typo in variable name ‘typee’ to ‘type’ if (type === ‘create’) { var form = nlapiGetFieldValue(‘customform’); // Renamed GetUrlValue to match the actual function name getQueryVariable var recordType = getQueryVariable(‘parentType’); // If the form is already the desired one, stop the script if (form == 178 && recordType… Continue reading Client Script for Extracting Values from URL