0
How to remove each element in an array
I'm making a program, it can remove each last element in an array but it doesn't work like i want how to do this please help me! Thanks before. Here is the code https://code.sololearn.com/WtuCiR6UV5fp/?ref=app
4 Réponses
+ 4
for(let i = myArr.length; i >5; i--)
... should do it
+ 6
window.onload = ()=>{
const myArr = ["Dandi","chika","angel","rizki","febian","jajang","eani"];
for(let i = myArr.length; i >= 0; i--){
myArr.splice(i,1);
}
console.log(myArr);
}
+ 4
Tenias mal la condición, por eso no funcionaba la eliminación de cada ítem del arreglo
0
Thanks everyone thank you so much !. The case already solved.