Use the literal syntax for object creation.
// bad
var item = new Object();
// good
var item = {};
Don’t use reserved words as keys. It won’t work in IE8. More info.
// bad
var superman = {
default: { clark: 'kent' },
private: true
};
// good
var superman = {
defaults: { clark: 'kent' },
hidden: true
};
Use readable synonyms in place of reserved words.
// bad
var superman = {
class: 'alien'
};
// bad
var superman = {
klass: 'alien'
};
// good
var superman = {
type: 'alien'
};