Class cannot be created by constructor

Hi,

function createPerson(name) {
const obj = {};
obj.name = name;
obj.introduceSelf = function () {
console.log(Hi! I’m ${this.name}.);
};
return obj;
}
undefined
const salva = createPerson(“Salva”);
salva.name;
salva.introduceSelf();

const frankie = createPerson(“Frankie”);
frankie.name;
frankie.introduceSelf();
VM1328:5 Hi! I’m Salva.
VM1328:5 Hi! I’m Frankie.
You sent
But can you tell this below statements in class declaration in javascript by Constructor

class Professor {
name: “Kaushik”,

greet() {
console.log(Greetings from ${this.name});
}
introduceSelf: function () {
console.log(Hi! I'm ${this.name}.);
}
}

Thanks
Kaushik

Would you please edit your message and format the code using the </> button on the formatting toolbar? Thanks.