I found some issue with .length = 0
and now if I change to = []
, all things are working well in my javascript project.
var arr = [1,2,3,4,5];
alert(arr);
arr = [];
alert(arr);
arr.length = 0;
alert(arr);
But I have one question if I use arr = []
, when the memory of [1,2,3,4,5] disappear? If the array is big and I use [] lots of times it will cause memory lack problems.