I'm taking an online web development course. I've come across some code that is confusing me. Within the index.js file there is a variable titled defaultCardList which instantiates a new instance of Section class. However, before the declaration is finished, within the renderer property, the defaultCardList variable is used to call the setItem method.
How is it possible to call the method from the defaultCardList variable before it's completely declared?
const defaultCardList = new Section({
data: items,
renderer: (item) => {
const card = new DefaultCard(item, ".default-card");
const cardElement = card.generateCard();
defaultCardList.setItem(cardElement); //How can this be called before its completion?
}
}, cardListSelector);