js-test-for-vs-foreach-vs-forof (v4)

Revision 4 of this benchmark created on


Description

for vs foreach vs forOf

Test runner

Ready to run.

Testing in
TestOps/sec
for
const list = ['1','2','3','4','5','6','7']
for(let i = 0;i<= i.length;i++){
	console.log(list[i])
}
ready
foreach
const list = ['1','2','3','4','5','6','7']
list.forEach((item) => {
	console.log(item)
})
ready
forOf
const list = ['1','2','3','4','5','6','7']
let item
for(item of list) {
	console.log(item)
}
ready

Revisions

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