Tag Archives: 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 toContinueContinue reading “JavaScript function is also a constructor?”
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 https://www.youtube.com/watch?v=F2V7MgehDSY
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 PatternConstructor Invocation PatternMethod Invocation PatternIndirect 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 } let a = add(8, 9); In theContinueContinue reading “Why use new.target inside a function in JavaScript – Simplified”