I have a complex object of this type:
class Person {
constructor(name, age, country) {
this.name = name;
this.age = age;
this.country = country;
}
setName(name) {
if (name !== null) this.name = name;
}
setAge(age) {
if (age !== null) this.age = age;
}
setCountry(country) {
if (country !== null) this.country = country;
}
getName() {
return this.name;
}
// ...
}
let person = new Person('Paul', 27, 'Haïti'); // needs to save this Object
console.log(person);
So I would like to know if anyone has an idea on how I can store this Object so that I can access it the next time I open the browser. localStorage doesn't work.