var array = [1, 2, 3, 4, 5]; //remove 3 from array
Exp:-
<script>
var array = [1, 2, 3, 4, 5];
$('#go').click(function () {
var index = array.indexOf(3);
array.splice(index,1);
console.log(array);
});
</script>
<button id='go'>Go</button>
output: 1,2,4,5
Exp:-
<script>
var array = [1, 2, 3, 4, 5];
$('#go').click(function () {
var index = array.indexOf(3);
array.splice(index,1);
console.log(array);
});
</script>
<button id='go'>Go</button>
output: 1,2,4,5
No comments:
Post a Comment