gistlib
There are several ways to initialize an empty object in JavaScript:
index.tsxconst emptyObject = {}; 24 chars2 lines
const emptyObject = {};
index.tsxconst emptyObject = new Object(); 34 chars2 lines
const emptyObject = new Object();
index.tsxconst emptyObject = Object.create(null); 41 chars2 lines
const emptyObject = Object.create(null);
index.tsxconst emptyObject = {}; emptyObject['key'] = 'value'; 54 chars3 lines
const emptyObject = {}; emptyObject['key'] = 'value';
index.tsxconst emptyObject = {}; const key = 'key'; const value = 'value'; const obj = { [key]: value }; 97 chars6 lines
const emptyObject = {}; const key = 'key'; const value = 'value'; const obj = { [key]: value };
gistlibby LogSnag