/
ragral
/
test
Обзор
Документация
Войти
/
ragral
/
test
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
user.js
44 строки
866 B
ragral
upload files
19 фев 2025, 20:52
19 фев 2025, 20:52
adfffb6
Код
Авторство
О чём код?
export function User(name, age){ this.name = name; this.age = age; this.print = function(){ console.log("Имя", this.name, "Возвраст", this.age); } } User.prototype.sayHi = function(){ console.log("Меня зовут", this.name); } export class User1 { constructor(name, age, year) { this.name = name; this.#age = age; this.#year = year; } name #age #year get age() { return this.#age } set age(value) { this.#age = value } get year() { return this.#year } set year(value) { this.#year = value } print() { console.log("Имя", this.name, "Возвраст", this.#age); } sayHi() { console.log("Меня зовут", this.name); } }