Creating null-filled objects (v2)

Revision 2 of this benchmark created on


Setup

const columnNames = ['a', 'b', 'c'];

Test runner

Ready to run.

Testing in
TestOps/sec
Using Object.fromEntries + map
Object.fromEntries(
    columnNames.map((columnName) => [columnName, null])
);
ready
Using Array.reduce
columnNames.reduce((carry, current) => {
	carry[current] = null
	return carry;
  }, {});
ready

Revisions

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