Answers for "how to pop more then one element js"

0

how to pop more then one element js

var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];

function removeItems(arr, item) {
    for ( var i = 0; i < item; i++ ) {
        arr.pop();
    }
}

removeItems(numbers, 2);
Posted by: Guest on August-04-2021

Code answers related to "how to pop more then one element js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language