Tag: new.target
-
Why use new.target inside a function in JavaScript – Simplified
There are four invocation patterns in JavaScript, which means you can call a function in four possible ways. They are, Function Invocation Pattern Constructor Invocation Pattern Method Invocation Pattern Indirect Invocation Pattern Essentially, these four-invocation patterns determine the value of ‘this’ object inside a function. Let us consider the function created below, function add(num1, num2) { console.log(this); // global object }…