//--------removing item from array
existingArray.splice( znum, 1); //znum is the spot to remove 0-(length-1)
//1 could be more if you want to remove more
//--------sort array by keys
//xOrderList[0] = { "name" : "Fred" , "ranktype" : "45" };
//xOrderList[1] = { "name" : "Jed" , "ranktype" : "35" };
//xOrderList[2] = { "name" : "Red" , "ranktype" : "55" };
xOrderList.sort(function(a,b) { return parseFloat(b.ranktype) - parseFloat(a.ranktype) } ); //highest to lowest
xOrderList.sort(function(a,b) { return parseFloat(a.ranktype) - parseFloat(b.ranktype) } ); //lowest to hights by ranktype
//--------duplicate an array
var xNewArray = existingArray.slice();
//note that if the array contains arrays or objects, this will not work as they are just pointers to those items
//--------duplicate an array of arrays
function duplicateArray( xArray ) {
var xTempArray = [];
console.debug( xArray.length );
for (var x=0; x<xArray.length; x++){
xTempArray.push( xArray[x].slice() );
}
return xTempArray;
}
var xNewArray = duplicateArray( existingArray );