Creating a new object

Benchmark created by Mathias Bynens on


Test runner

Ready to run.

Testing in
TestOps/sec
Object constructor
var obj = new Object();
obj.x = 42;
obj.y = 'foo';
obj.z = false;
ready
Object literal + setting props separately
var obj = {};
obj.x = 42;
obj.y = 'foo';
obj.z = false;
ready
Object literal
var obj = {
  'x': 42,
  'y': 'foo',
  'z': false
};
ready

Revisions

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

  • Revision 1: published by Mathias Bynens on