Array within an array, within an object?

javascript

Solution

You missed a step. You haven't declared `HeroName.Spells[0]` to be an object, so you can't a `Type` property to it, because it doesn't exist. This works:

HeroName = new Hero();
HeroName.Spells = [];
HeroName.Spells[0] = {};
HeroName.Spells[0].Type = [];

Problem

``` HeroName = new Hero() HeroName.Spells = []; HeroName.Spells[0].Type = []; ``` This doesnt work =( , even if I try new Array() or anything else. Is it not possible to do arrays within arrays? This is what I was going for: ``` HeroName.Spells[0].Type[0] = new DmgSpell(); HeroName.Spells[0].Type[1] = new Buff(); ``` I know I can do something like ``` HeroName.Spells[0][0] = new DmgSpelL(); HeroName.Spells[0][1] = new Buff(); ``` But this doesn't make it as easy to read Am I doing something wrong? I've tried every possible combination I could think of and using google to search 'array within an array' gives me other results that don't help me. Any help is greatly appreciated

Original source