Question on ES6 syntax.
The ES6 notation of classes provides for the elegant creation of static methods, getters / setters, and it is also convenient to describe all methods for class instances in a block instruction.
And what about setting the "flags" (writable, configurable, etc) for the properties of the generated objects? Is it true that additional wrappers are still needed?
'use strict'; function User(name, age) { class User { constructor() { this.name = name; } } let user = new User(name); Object.defineProperties(user, { gender: { value: 'male' }, age: { get: function() { return age; }, set: function(value) { alert('Молодость не вернешь!'); return false; } } }); return user; } const user = new User('Vasya', 23); user.age = 16; console.log(user.age);