## 'new' keyword
The new keyword invokes a function in a special way. Functions invoked using the new keyword are called constructor functions.
So what does the new keyword actually do?
1. Creates a new object.
2. Sets the object’s prototype to be the prototype of the constructor function.
3. Executes the constructor function with this as the newly created object.
4. Returns the created object. If the constructor returns an object, this object is returned.
```sh
// In order to better understand what happens under the hood, lets build the new keyword
function myNew(constructor, ...arguments) {
var obj = {}
Object.setPrototypeOf(obj, constructor.prototype);
return constructor.apply(obj, arguments) || obj
}
```
What is the difference between invoking a function with the new keyword and without it?
```sh
function Bird() {
this.wings = 2;
}
/* invoking as a normal function */
let fakeBird = Bird();
console.log(fakeBird); // undefined
/* invoking as a constructor function */
let realBird= new Bird();
console.log(realBird) // { wings: 2 }
```