...
.then(resp => {
load = resp;
})
...
class User {
constructor({ name, age, city }) {
this.name = name;
this.age = age;
this.city = city;
}
get all() {
return `${this.name} ${this.age} ${this.city}`;
}
}
fetch("ajax.json").then(function(res){
return res.json();
}).then(function(res) {
const user = new User(res);
document.write(user.all);
}).catch(e => { console.error(e); });