I am having troubles accessing a object, I tried to define a let
and write a new object to it, however when I try to access it, is not possible, this is what my attempt looks like:
function Player(uniqueId, name, figureString, motto, memberSince) {
this.uniqueId = uniqueId;
this.name = name;
this.figureString = figureString;
this.motto = motto;
this.memberSince = memberSince;
}
...
let player;
getUser
.then((res) => {
player = new Player(res.uniqueId, res.name, res.figureString, res.motto, res.memberSince);
})
.catch(() => {
...
});
// Trying to access player here
console.log(player.name + player.figureString);