Garbage collection in JavaScript
The JavaScript engine uses automatic garbage collection. JavaScript automatically manages memory by freeing up space used by objects no longer needed....
48개의 노트
The JavaScript engine uses automatic garbage collection. JavaScript automatically manages memory by freeing up space used by objects no longer needed....
Explicit binding is a way to explicitly state what the `this` keyword is going to be bound to using `call`, `apply` or `bind` methods of a function.
The Heap and Stack in JavaScript Engine are two different data structures that store data in different ways.
A scope is a set of variables, objects, and functions that you have access to. There are three types of scopes in JavaScript. Which are Global Scope, ...
A closure is a function that has access to its outer function scope even after the outer function has returned. This means a closure can remember and ...
A Promise in JavaScript represents a value that may not be available yet but will be at some point. Promises provide a way to handle asynchronous oper...
**Callback hell**, often referred to as **Pyramid of Doom**, describes a situation in JavaScript where multiple nested callbacks become difficult to m...
The Document Object Model (DOM) is a programming interface for HTML and XML documents. It represents the page so that programs can change the document...
Event capturing is the first phase of event propagation. In this phase, the event is captured by the outermost element and propagated to the inner ele...
The Event loop is one the most important aspect to understand in JavaScript. It is the mechanism that allows JavaScript to perform non-blocking operat...
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution. This means tha...
Inheritance is a way to create a new `Class` from an existing `Class`. The new `Class` inherits all the properties and methods from the existing `Clas...
JavaScript (often abbreviated as JS) is a high-level, versatile, and widely-used programming language primarily known for its role in web development....
The prototype chain in JavaScript refers to the chain of objects linked by their prototypes. When a property or method is accessed on an object, JavaS...
Type conversion (or typecasting) means transfer of data from one data type to another. Implicit conversion happens when the compiler (for compiled lan...
No, arrow functions do not have their own `this`. Instead, they inherit the `this` of the enclosing lexical scope.
The Event loop has two main components: the Call stack and the Callback queue.
No, it is not possible to run 2 lines of code at the same time in JavaScript. JavaScript is a single-threaded language, which means that it can only e...
Yes, it is possible to run JavaScript outside the browser. There are several ways to run JavaScript outside the browser. You can use **Node.js**, **De...
JavaScript is an interpreted language. This means that the JavaScript code is not compiled before it is executed. Instead, the JavaScript engine inter...
Node.js is an open-source and cross-platform JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O...
REPL stands for Read-Eval-Print-Loop. It is an interactive shell that allows you to execute JavaScript code and view the output immediately. It is use...
No, you cannot access the DOM in Node.js because it does not have a DOM. It is a server-side runtime for JavaScript, so it does not have access to the...
There are four fundamental strategies to report errors in Node.js:
Hydration is the process of using client-side JavaScript to add interactivity to the markup generated by the server. When you use server-side renderin...
Pure components re-render only when the props passed to the component changes. For example, if you have a pure child component inside a parent compone...
By default, each component’s DOM nodes are private. However, sometimes it’s useful to expose a DOM node to the parent—for example, to allow focusing i...
React differs from HTML in that it uses a synthetic event system instead of directly binding to the browser’s native events. This system brings consis...
React, is an open-source JavaScript library for building user interfaces (UIs). It was developed and is maintained by Meta, and is widely used by deve...
When building a modern web application, bundlers such as
> Compress your JavaScript and keep an eye on your chunk sizes for optimal performance. Overly high JavaScript bundle granularity can help with dedupl...
In our chat application, we have four key components: `UserInfo`,
> tl;dr: lazy-load non-critical resources when a user interacts with UI requiring it
Besides user interaction, we often have components that aren't visible on the initial page. A good example of this is lazy loading images that aren't ...
**Note:** This article is heavily influenced by insights from the
Prefetch is a browser optimization which allows us to fetch resources that may be needed for subsequent routes or pages before they are needed
Preload is a browser optimization that allows critical resources (that may be discovered late) to be requested earlier
Making our applications globally accessible can be a challenge! We have to make sure the application is performant on low-end devices and in regions w...
> tl;dr: Third-party resources can slow down sites and can be a challenge to optimize. You can follow certain best practices to load or delay differen...
It can happen that we add code to our bundle that isn't used anywhere in our application. This piece of dead code can be eliminated in order to reduce...
In this guide, we will discuss list virtualization (also known as
No, arrow functions do not have their own `this`. Instead, they inherit the `this` of the enclosing lexical scope.
The Event loop has two main components: the Call stack and the Callback queue.
JavaScript is an interpreted language. This means that the JavaScript code is not compiled before it is executed. Instead, the JavaScript engine inter...
No, it is not possible to run 2 lines of code at the same time in JavaScript. JavaScript is a single-threaded language, which means that it can only e...
Yes, it is possible to run JavaScript outside the browser. There are several ways to run JavaScript outside the browser. You can use **Node.js**, **De...
No, you cannot access the DOM in Node.js because it does not have a DOM. It is a server-side runtime for JavaScript, so it does not have access to the...
There are four fundamental strategies to report errors in Node.js: