Javascript: Fancy trick to delete item from array


var fruits = ["Banana", "Orange", "Apple", "Mango"],
idx = fruits.indexOf( "Apple" );
fruits = fruits.slice( 0, idx ).concat( fruits.slice( idx+1 ) );
// Result: ["Banana", "Orange", "Mango"]