hi,
i need to add ‘GGG’ to an existing array, but at a certain position without overwriting other elements. is there a way to do this without looping over the array and reinsert the elements?
thanks
pete
existing array: ‘XXX’,‘YYY’,‘TTT’);
final array should be: ‘XXX’,‘GGG’,‘YYY’,‘TTT’);
var myArray = new Array('XXX','YYY','TTT');
//get position of YYY
var pos = myArray.indexOf('YYY');
//add GGG at the postion of YYY
myArray[pos] = 'GGG';
// how can i readd YYY,TTT