Skip to content

Instantly share code, notes, and snippets.

@ychaouche
Created July 26, 2012 17:37
Show Gist options
  • Save ychaouche/3183392 to your computer and use it in GitHub Desktop.
Save ychaouche/3183392 to your computer and use it in GitHub Desktop.
//1
obj = {key:value};
//2
obj = Object.create(null);
obj[key] = value;
//3
obj = Object.create(null);
Object.defineProperty(obj,"key",{value:value, flags...});
//variante
Object.defineProperties(obj,{key1 : {value:value, flags...}, key2 : {value:value, flags...}});
//4
obj = Object.create(null);
obj.key = value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment