Tag: constructor
-
JavaScript function is also a constructor?
JavaScript function is also a “constructor.” You must have heard it many times, haven’t you? Well, that is a wrong way of interpreting the JavaScript function; even though you can create an object using a function, it does not mean you can call it a constructor. Let us discuss it: There are four ways to…
-
Video- Master 3 important concepts of JavaScript
In this webinar learn 3 most important concepts of JavaScript. How to calculate the value of ‘this’ inside a function All about object literals function constructors and prototypes
-
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 }…