+ 1
Which is not a correct way to empty an array?
let arr = [2, 4, 6, 12]; A. arr = []; B. arr.length = 0; C. arr.splice(0, arr.length); D. While(arr.length > 0) { arr.push();}
2 Answers
+ 4
Like Kaminorsabir Kamin said, it is an infinite loop.
You are adding elements to the array. So the array length always will be > 0.
+ 3
D. is Infinite loop