The goal of the following code is to create a 2d array such that
- Clip is a custom object
- a Bank is an array of (8) clips
- Banks is an array of (8) banks
- Each clip is accessible by banks[a][b], where a is an index in banks (a bank) and b is an index in clips (a clip)
In its current state it returns undefined, alas I am at a loss to explain why. Any suggestions about what I'm doing wrong would be greatly appreciated
var banks = []
function Clip(a,b)
{
this.track = a
this.slot = b
}
function Bank(w)
{
for (var j, j = 0; j <= 7; j++) {
var clips = []
var aClip = new Clip(w,j);
//post(i)
//post(aClip.length)
clips[j] = aClip
}
//post();
return clips
}
function makeBanks()
{
for (var k, k = 0; k <= 7; k++) {
var aBank = Bank(k);
//post(i)
//post (aClip.length)
banks[k] = aBank
}
}
makeBanks();
console.log(banks[0][0])
Many thanks in advance