class Hello1 {
constructor(a, b) {
this.a = a;
this.b = b;
}
sayHello() {
return this.a + this.b;
}
}
class Hello2 {
constructor(a, b) {
this.a = a;
this.b = b;
}
sayHello = () => {
return this.a + this.b;
}
}
const Hello3 = (a, b) => ({
a,
b,
sayHello() {
return this.a + this.b;
},
});
function sayHello() {
return this.a + this.b;
}
const Hello4 = (a, b) => ({
a,
b,
sayHello,
});
function Hello5(a, b) {
this.a = a;
this.b = b;
this.sayHello = function() {
return this.a + this.b;
};
}
function Hello6(a, b) {
this.a = a;
this.b = b;
}
Hello6.prototype.sayHello = function() {
return this.a + this.b;
};
function sayHello2(self) {
return self.a + self.b;
}
const Hello7 = (a, b) => ({
a,
b,
});