MACHIN
This commit is contained in:
4
2/app.js
Normal file
4
2/app.js
Normal file
@@ -0,0 +1,4 @@
|
||||
const User = require('./user.js');
|
||||
|
||||
let eugene = new User('Eugene', 32);
|
||||
eugene.sayHi();
|
||||
14
2/user.js
Normal file
14
2/user.js
Normal file
@@ -0,0 +1,14 @@
|
||||
function User(name, age) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
this.displayInfo = function () {
|
||||
console.log(
|
||||
`Имя: ${this.name} Возраст: ${this.age}`
|
||||
);
|
||||
};
|
||||
}
|
||||
User.prototype.sayHi = function () {
|
||||
console.log(`Привет, меня зовут ${this.name}`);
|
||||
};
|
||||
|
||||
module.exports = User;
|
||||
Reference in New Issue
Block a user