I am busy creating an object. The end goal is that each evolution will link to a creature in another object.
let fresh = {
botamon: {
name: "Botamon",
image: new URL("https://www.grindosaur.com/img/games/digimon-world/digimon/12-botamon.jpg"),
stage: "Fresh",
type: "Data"
},
}
let inTraining = {
koromon: {
name: "Koromon",
image: new URL("https://www.grindosaur.com/img/games/digimon-world/digimon/50-koromon.jpg"),
stage: "In-Training",
type: "Data",
preDigivolution: fresh.botamon,
line: rookie.agumon
},
}
let rookie = {
agumon: {
name: "Agumon",
Image: new URL("https://www.grindosaur.com/img/games/digimon-world/digimon/1-agumon.jpg"),
Stage: "Rookie",
Type: "Vaccine",
PreDigivolution: inTraining.koromon
},
}
The line: rookie.agumon
throws an error, because the way this works is that koromon
evolves to agumon
so I have no idea why its throwing an error, the error is
digimon-digivolution.js:41 Uncaught ReferenceError: Cannot access 'rookie' before initialization
is it incorrect to call rookie.agumon in the koromon object?