小编and*_*ias的帖子

Best way to deallocate an array of array in javascript

What is the best way to deallocate an array of array in javascript to make sure no memory leaks will happen?

var foo = new Array();
foo[0] = new Array();
foo[0][0] = 'bar0';
foo[0][1] = 'bar1';
foo[1] = new Array();
...
Run Code Online (Sandbox Code Playgroud)
  1. delete(foo)?
  2. iterate through foo, delete(foo[index]) and delete(foo)?
  3. 1 and 2 give me the same result?
  4. none?

javascript

6
推荐指数
2
解决办法
6539
查看次数

标签 统计

javascript ×1