how to remove the element at the beginning of array javascript code example
Example 1: js delete all from array
var list = [1, 2, 3, 4];
function empty() {
//empty your array
list.length = 0;
}
empty();
Example 2: remove elemtns from an array with splice
var fruits = ["Banana", "Orange", "Apple", "Mango", "Kiwi"];
document.getElementById("demo").innerHTML = fruits;
function myFunction() {
fruits.splice(2, 2);
document.getElementById("demo").innerHTML = fruits;
}