es6-数组解构语法

Benchmark created on


Setup

const arr = [1, 2, 3, 4, 5];  
let a, b, c, d, e; 

Test runner

Ready to run.

Testing in
TestOps/sec
数组解构赋值
[a, b, c, d, e] = arr;
ready
普通赋值
a = arr[0];  
b = arr[1];  
c = arr[2];  
d = arr[3];  
e = arr[4];
ready

Revisions

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