Emptying an array (v27)

Revision 27 of this benchmark created on


Setup

var arr = ['apples', 'pears', 'oranges', 'lemons', 'kiwis', 'bananas', 'strawberries', 'grapefruits', 'pineapples', 'satsumas', 'lychees'];

Test runner

Ready to run.

Testing in
TestOps/sec
Setting .length to 0
arr.length = 0;
console.log(arr);
ready
Creating a new empty array
arr = [];
console.log(arr);
ready
New array as new Array()
arr = new Array();
console.log(arr);
ready
poping
while (arr.length) {
    arr.pop();
}
console.log(arr);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.