I have an array.
var arr =[23,45,78,89];
I want to delete 78 from this array so i am using
arr.splice($.inArray(78), 1);
but this always remove last element 89.
Plz help .
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have to pass the
arrtojQuery.inArray:You should also verify that the value was found before splicing:
splicewill treat the-1to mean “1st from end” (or “last”).