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