DAMO'S BLOG

Remote Full-Stack Engineer | Supports North America/Europe Time Zones

What happens when using new with a constructor function in JavaScript?

When using the new operator to call a function (known as a constructor) in JavaScript, the following four key steps occur: 1. A new empty object is created The JavaScript engine first creates a brand-new empty object: 2. The new object’s prototype ([[Prototype]]) is set The internal prototype ([[Prototype]], accessible via __proto__ or Object.getPrototypeOf()) of

Four binding methods for this

In JavaScript, the binding of this primarily follows four rules, listed below in order of priority from highest to lowest: 1. New Binding When a function is invoked with the new keyword (i.e., as a constructor), a new object is created, and this is bound to that new object. Here, this refers to the newly created

Call, Apply, and Bind

In JavaScript, call, apply, and bind are three methods of function objects, all used to explicitly set the this value (i.e., change the context) when a function is invoked. Although their functionality is similar, they differ in how they are called and how arguments are passed. 1.call syntax: Features: Manual implementation example: 2.apply syntax: Features:

Debounce and Throttle Functions

In JavaScript, debounce and throttle are two commonly used techniques for optimizing high-frequency event handling. Both reduce the execution frequency of functions, thereby improving performance and avoiding unnecessary computations or requests. Below is a detailed explanation, implementation approach, and common usage scenarios encountered during development. 1. Debounce “Debounce” means: when an event is triggered frequently,

Tech Stack

Nestjs,PHP,Angular,React,Vue

Contact Me

地址
123 Main Street
New York, NY 10001

营业时间
星期一—五:9:00–17:00
星期六—日:11:00–15:00