3 ms·
I find the following version more intuitive: const lea = { name: "Lea Verou", _id: null, get id() { return this._id || this.name.
by janpot 6y ago
I find the following version more intuitive:
const lea = {
name: "Lea Verou",
_id: null,
get id() {
return this._id || this.name.toLowerCase().replace(/\W+/g, "-");
},
set id(v) {
this._id = v;
}
}