Answer the question
In order to leave comments, you need to log in
How to link objects?
Hello.
The question is more architectural.
Let's say I have Player and Card objects.
Looks like this:
class User{
constructor(id, name){
this.userId = id;
this.name = name;
}
}
class Card{
constructor(){
Object.setPrototypeOf(Card.prototype, gameSetting);
}
createCard(){
this.card = document.createElement('div');
//.....
}
//Some methods here
}
Create new Card
that creates a card (new Card()) in the DOM (there may be many of them). alert "This card belong to user${userId}"
. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question