Don't use A.slice(0) to empty an array in Javascript
As explained on StackOverflow:
Instead use:
A.length = 0
or:
A.splice(0,A.length)
As explained on StackOverflow:
Instead use:
A.length = 0
or:
A.splice(0,A.length)