Answer the question
In order to leave comments, you need to log in
How to write hello method using ES6 syntax?
function User(name) {
this.name = name;
this.hello = function () { //метод hello
console.log ("Мене зовут" + this.name);
};
}
let userOne = new User("Вася");
let userSecond = new User("Саша");
userOne.hello();
Answer the question
In order to leave comments, you need to log in
class User {
constructor(name) {
this.name = name;
}
hello() { //метод hello
console.log ("Мене зовут" + this.name);
};
}
let userOne = new User("Вася");
let userSecond = new User("Саша");
userOne.hello();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question