Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Chrome 65
Mac OS X 10.13.3
Other
6 years ago
Test name Executions per second
Array.prototype.concat 50892.4 Ops/sec
spread operator 388.6 Ops/sec
Lodash merge 2122.1 Ops/sec
HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
 
var array1 = (new Array(10000)).fill(Math.random(), 0, 9999);
var array2 = (new Array(10000)).fill(Math.random(), 0, 9999);
Tests:
  • Array.prototype.concat

     
    var other = array1.concat(array2);
  • spread operator

     
    var other = [ ...array1, ...array2 ]
  • Lodash merge

     
    var other = _.merge([], array1, array2);