function deleteElement(array, n) { //delete the nth element of array var length = array.length; if (n >= length || n<0) return; for (var i=n; i