Skip to content

Instantly share code, notes, and snippets.

@jeroenbourgois
Created September 14, 2012 07:05
Show Gist options
  • Save jeroenbourgois/3720384 to your computer and use it in GitHub Desktop.
Save jeroenbourgois/3720384 to your computer and use it in GitHub Desktop.
// bad
var obj = {'prop':'value', 'prop':'value', 'prop':'value'};
var obj = {'prop':'value',
'prop':'value',
'prop':'value'};
var obj = {
'prop':'value',
'prop':'value',
'prop':'value'
};
// good
var obj = {
'prop': 'value',
'prop': 'value',
'prop': 'value'
};
// good - deeper indentation
function Foo() {
...
if(bar === 'cool') {
var baz = {
'prop': 'value',
'prop': 'value'
}
}
}
// good - variable long property names may be aligned on the ':'
var obj = {
'prop_a_bit_longer' : 'value',
'prop_very_very_very_long' : 'value',
'prop_short' : 'value'
};
// good - but it's not mandatory
var obj = {
'prop_a_bit_longer': 'value',
'prop_very_very_very_long': 'value',
'prop_short': 'value'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment