C
Chris S.
All,
I'm kind of at a lose this is my first foray into using a multi-dimensional
array and I've run into a snag. for some reason the second dimension always
seems to end up being the last value of the second dimension of the array
ie: in the case below the conditionArray[[0][1]] always ends up being 6.0
where it should be 1.0.
If someone could look at this and tell me what I'm doing wrong I'd be
grateful
Chris S.
var tmp = new Array();
tmp[0] = "Value 1 - 1.0";
tmp[1] = "Value 2 - 2.0";
tmp[2] = "Value 3 - 3.0";
tmp[3] = "Value 4 - 4.0";
tmp[4] = "Value 5 - 5.0";
tmp[5] = "Value 6 - 6.0";
var conditionArray = new Array();
var conditionArrayPosition = 0;
for(var i = 0;i < tmp.length;i++){
var x = tmp.split(" - ");
conditionArray[[conditionArrayPosition][0]] = x[0];
conditionArray[[conditionArrayPosition][1]] = x[1];
conditionArrayPosition++;
}
document.getElementById('test').innerHTML = conditionArray[[2][0]] + " --
" + conditionArray[[0][1]];
I'm kind of at a lose this is my first foray into using a multi-dimensional
array and I've run into a snag. for some reason the second dimension always
seems to end up being the last value of the second dimension of the array
ie: in the case below the conditionArray[[0][1]] always ends up being 6.0
where it should be 1.0.
If someone could look at this and tell me what I'm doing wrong I'd be
grateful
Chris S.
var tmp = new Array();
tmp[0] = "Value 1 - 1.0";
tmp[1] = "Value 2 - 2.0";
tmp[2] = "Value 3 - 3.0";
tmp[3] = "Value 4 - 4.0";
tmp[4] = "Value 5 - 5.0";
tmp[5] = "Value 6 - 6.0";
var conditionArray = new Array();
var conditionArrayPosition = 0;
for(var i = 0;i < tmp.length;i++){
var x = tmp.split(" - ");
conditionArray[[conditionArrayPosition][0]] = x[0];
conditionArray[[conditionArrayPosition][1]] = x[1];
conditionArrayPosition++;
}
document.getElementById('test').innerHTML = conditionArray[[2][0]] + " --
" + conditionArray[[0][1]];