Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
array for vs some (test)
Compare the new ES6 spread operator with the traditional concat() method
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/119.0
Browser:
Firefox 119
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
array for
113271664.0 Ops/sec
array some
97175456.0 Ops/sec
HTML Preparation code:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.core.js"></script>
Tests:
array for
var a = ['hello', 'a', 'bc']; function find(target, arr) { for (let i = 0; i < arr.length; i++) { if (target === arr[i]) return true; } return false; } var b = find('bc', a);
array some
var a = ['hello', 'a', 'bc']; var b = a.some(item => item === 'bc');