let a = [].concat(b);b = [];
I need to make a copy of array B from array A and clean array B.
Is it guaranteed that after line 1 line 2 will be immediately executed?
And then suddenly the execution will go to the code section, where data will be added to array B and then it will be cleared, but array A will not have this element.
a = b.slice()- faster and does not create an extra empty array. - Alexey Ten