pilau
05-04-2007, 03:06 PM
If I get it right, the splice method only works if all of the indexes in the array are numerical values? (i.e. 0, 1, 2, 3, ...)
I tried using it when the indexes were strings, not numbers - and it didn't work:
var x = new Array();
x['one'] = 'a;
x['two'] = 'b';
x['three'] = 'c';
x['four'] = 'd';
x.splice('two', 1);
for (i in x)
{
document.write(x[i] + '<br />');
}
</scr
I tried using it when the indexes were strings, not numbers - and it didn't work:
var x = new Array();
x['one'] = 'a;
x['two'] = 'b';
x['three'] = 'c';
x['four'] = 'd';
x.splice('two', 1);
for (i in x)
{
document.write(x[i] + '<br />');
}
</scr