var hero = {
let character = Math.floor(Math.random() * 8);
if (character === 0) {
character = 'D.J. Sparkstorm';
} else if (character === 1) {
character = 'Forest Guardian Rose';
} else if (character === 2) {
character = 'Infernal Arrow';
} else if (character === 3) {
character = 'Captain L. Ness';
} else if (character === 4) {
character = 'Radiant Knight';
} else if (character === 5) {
character = 'Frozen Fist';
} else if (character === 6) {
character = 'Element';
}
let evolve = Math.floor(Math.random() * 8);
if (character === 7) {
if (evolve === 0) {
evolve = 'D.J. Flarestorm';
} else if (evolve === 1) {
evolve = 'Frozen Tundra Guardian Rose';
} else if (evolve === 2) {
evolve = 'Sunflame Arrow';
} else if (evolve === 3) {
evolve = 'Arctic Admiral L. Ness';
} else if (evolve === 4) {
evolve = 'Solarain Knight';
} else if (evolve === 5) {
evolve = 'Icicleflare Fist';
} else if (evolve === 6) {
evolve = 'Cosmic Emporer Element';
}
let overload = Math.floor(Math.random() * 7);
if (evolve === 7) {
if (overload === 0) {
overload = 'D.J. Excelling Thunder';
} else if (overload === 1) {
overload = 'Forest Reviver Rose';
} else if (overload === 2) {
overload = 'Flaming Wrath Arrow';
} else if (overload === 3) {
overload = 'Ocean General L. Ness';
} else if (overload === 4) {
overload = 'Shining Paladin';
} else if (overload === 5) {
overload = 'Roaring Blizzard Fist';
} else if (overload === 6) {
overload = 'Universal God Element';
}
}
}
}
console.log(hero);
I tried using {} to select all of the code, and figured that would work, but it ended up creating an error for another part of the code. Another thing I tried was putting the code all on the same line as the variable declaration, but the same error occurred. Is there something that I am doing wrong, or will this just not work at all.