I've found following code at JS tutorial page and I'm quite unsure what does it do and how it work. Can you please explain what is it for and what it does?
// Source is : https://javascript.info/property-accessors
let user = {
name: "John",
surname: "Smith",
get fullName() {
return `${this.name} ${this.surname}`;
},
set fullName(value) {
[this.name, this.surname] = value.split(" "); <<<<<<<<<<<<<<<<<<<<<<<<<
}
};
// set fullName is executed with the given value.
user.fullName = "Alice Cooper";
alert(user.name); // Alice
alert(user.surname); // Cooper