Hello Friends,
Here, Using jQuery remove the Value and index from the array !
/*Remove Values and index from Array*/
/*Array['Apple','Banana','Lemon']*/
I hope this will helpful to you !
Thanks
Here, Using jQuery remove the Value and index from the array !
/*Remove Values and index from Array*/
jQuery
var sample_array = new Array('Apple','Banana','Mango','Lemon');
var val = "Mango";
remove_item(sample_array,val);
var remove_item = function (arr, value) {
var b = '';
for (b in arr) {
if (arr[b] === value) {
arr.splice(b, 1);
break;
}
}
return arr;
}
/*Result will be*/var val = "Mango";
remove_item(sample_array,val);
var remove_item = function (arr, value) {
var b = '';
for (b in arr) {
if (arr[b] === value) {
arr.splice(b, 1);
break;
}
}
return arr;
}
/*Array['Apple','Banana','Lemon']*/
I hope this will helpful to you !
Thanks
No comments:
Post a Comment