Is there any difference between the two methods of setting up a class in javascript:
Example 1:
class Friend {
constructor(name) {
this.name = name;
}
}
var friendOne = new Friend('John');
Example 2:
function Friend(name){
this.name = name;
}
var friendOne = new Friend('John');
Both of these examples create:
// Friend.prototype
// {constructor: ƒ}
So my question is related to what approach is best for creating class based inheritance with Javascript?
Thanks