Devil Naming

Benchmark created on


Description

4 different ways to use map()

Setup

const devils = [
	{
		name: "Moses",
		nickname: "Drowner"
	},
	{
		name: "Muhammad",
		nickname: "Idol"
	}
]

Test runner

Ready to run.

Testing in
TestOps/sec
Anonymous Function
const names = devils.map(devil => devil.name);
names;
ready
Anonymous Function with Return
const names = devils.map(devil => { 
	return devil.name
});
names;
ready
Unnamed Function
const names = devils.map(function(devil) { 
	return devil.name
});
names;
ready
Named function
function getName(devil) {
	return devil.name
}
const names = devils.map(getName);
names;
ready

Revisions

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