I have ran the simple javascript code. where i want to delete an element from the array. it is not being completely deleted although it remains undefined after deleting the element itself. it should not leave any gap in the array.
var arr = ['dog',34,36.33,'apple',,,];
alert(arr);
delete arr[2];
alert(arr);
i have check the syntax of delete is correct. Am i doing wrong. if it is so, please find the soln. i want complete array free from deleted elements.
deletedoes delete properties, not splice items out of an array.