array in func vs array out of func

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
array in func
function f(x) {
	const a = [1,2,3,4,5];
	return a.includes(x);
}

f(10);
ready
array out of func
const a = [1,2,3,4,5];

function f(x) {
	return a.includes(x);
}

f(10);
ready
array in arrow func
const f = (x) => {
	const a = [1,2,3,4,5];
	return a.includes(x);
}

f(10);
ready
array out of arrow func
const a = [1,2,3,4,5];

const f = (x) => {
	return a.includes(x);
}

f(10);
ready

Revisions

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