What the heck does "new" operator in JS do?
All of must have written this code in Javascript
let person = new Person("Eren Yeager", 19);
And we all know that we get a person object and voila! Now we can access properties/ methods on it.
person.age //19
person.name //Eren Yeager
person.transfo...
munish.hashnode.dev3 min read
Ankur Rajput
This is really good.
There is only one exception in the returned value that I am aware of. If the constructor function returns an object then instead of the newly created object that object will be returned. The return statement will be ignored if it is of a primitive type.