var arr = [1,2,3,4,5]; function f(a) { for (; a.length; ) {a.pop()} } f(arr) alert(JSON.stringify(arr))
var arr = [1,2,3,4,5]; function f(a) { a.length = 0; } f(arr) alert(JSON.stringify(arr))