ob1kanobee
Programmer
Need help on removing an element from an array. Although this works, I'm hoping you have a better or more efficient way of accomplishing this:
function deleteRow(index)
{
for (var x = index; x < MyArray.length-1; x++)
{
MyArray[x] = ProfileArray[x+1];
}
MyArray.length = MyArray.length-1;
return;
}
MyArray[0] = ["1","2","3"];
MyArray[1] = ["4","5","6"];
MyArray[2] = ["7","8","9"];
MyArray[3] = ["A","B","C"];
MyArray[4] = ["D","E","F"];
deleteRow(2);
//This is the result I'm looking for after the method call...
MyArray[0] = ["1","2","3"];
MyArray[1] = ["4","5","6"];
MyArray[2] = ["A","B","C"];
MyArray[3] = ["D","E","F"];
function deleteRow(index)
{
for (var x = index; x < MyArray.length-1; x++)
{
MyArray[x] = ProfileArray[x+1];
}
MyArray.length = MyArray.length-1;
return;
}
MyArray[0] = ["1","2","3"];
MyArray[1] = ["4","5","6"];
MyArray[2] = ["7","8","9"];
MyArray[3] = ["A","B","C"];
MyArray[4] = ["D","E","F"];
deleteRow(2);
//This is the result I'm looking for after the method call...
MyArray[0] = ["1","2","3"];
MyArray[1] = ["4","5","6"];
MyArray[2] = ["A","B","C"];
MyArray[3] = ["D","E","F"];