1

So if you want to define a array of objects you would do this:

public racks: Rack[];

However, I want to able to make an array that takes in more arrays of racks so for example,

[ 
  [rack1, rack2, rack3], 
  [rack4, rack5, rack6], 
  [rack7] 
]

My question is how do I define it so it can accept this kind of variable?

2 Answers 2

2

You could define an array of arrays of Rack :

public racks: Rack[][];
Sign up to request clarification or add additional context in comments.

Comments

2

you're looking for:

public racks: Array<Array<Rack>>;

or less verbose:

public racks: Rack[][];

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.