<script src="
https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js
"></script>
var arr1 = ["what", "is", "this"];
var arr2 = ["this", "is", "a", "test", "hello", "how", "are", "you", "today"];
var result = arr1.concat(arr2);
var result = _.concat(arr1, arr2);
Array.prototype.push.apply(arr1, arr2);
var result = [arr1, arr2]
for (var i = 0, l = arr2.length; i < l; i++) {
arr1.push(arr2[i])
}
--enable-precise-memory-info
flag.
Test case name | Result |
---|---|
Array.prototype.concat | |
Lodash concat | |
Array.prototype.push.apply() | |
spread operator | |
cached for + push |
This benchmark does not have any results yet. Be the first one to run it!