Tuesday 30 April 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...