var myArray = yourArray = [1, 2, 3]; // :( myArray = []; // "yourArray" is still [1, 2, 3] // The right way, keeping reference myArray.length = 0; // "yourArray" and "myArray" both []
The random technical musings of Justin Sternberg
var myArray = yourArray = [1, 2, 3]; // :( myArray = []; // "yourArray" is still [1, 2, 3] // The right way, keeping reference myArray.length = 0; // "yourArray" and "myArray" both []