Objects Created With Classes (ES6) vs. Objects Created With Constructor Functions (ES5)
Are they exactly the same?
Although they seem to be the same, upon expanding the inner
__proto__ , we get to see the difference between the two.
Upon expanding the
__proto__ for the instance created with the class syntax, we get nothing in the inner
On the other hand, expanding the inner
__proto__ for the instance created with the constructor function gives the result as:
With classes, we get no inheritance by default and we get a pure object assigned to the inner
__proto__ property of the
User object’s prototype.
We can also do that by explicitly modifying the inner