Tuesday, April 30, 2019

Javascript- is there a way to destroy all elements of an array by one command?

my script creates an empty array and then fill it. But if new arguments come then script is expected to destroy old one and create new one.




var Passengers = new Array();

function FillPassengers(count){
for(var i=0;i Passengers[i] = i;
}


I wanna destroy the old one because new count may be less than old one and last elements of array still will store old array? is that right and if it is how can I destroy it?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...