Skip to content

Instantly share code, notes, and snippets.

@ratherironic
Created October 17, 2013 20:43
Show Gist options
  • Save ratherironic/7031874 to your computer and use it in GitHub Desktop.
Save ratherironic/7031874 to your computer and use it in GitHub Desktop.
Question: which of these do you prefer?
/* 1: SPACING AFTER 'function' */
// A
function throwWaterBalloon(person){
person.isWet = true;
}
// B
function throwWaterBalloon (person){
person.isWet = true;
}
/* 2: SPACING AFTER '{' */
// A
function throwWaterBalloon(person){
person.isWet = true;
}
// B
function throwWaterBalloon(person) {
person.isWet = true;
}
/* 3: SPACING BEFORE + AFTER '( & )' */
// A
function throwWaterBalloon(person) {
person.isWet = true;
}
// B
function throwWaterBalloon( person ) {
person.isWet = true;
}
@haroldjones
Copy link

ABB

@bento-n-box
Copy link

ABA

@ericglasser
Copy link

ABB

When 3 is B it making it easier when you have multiple arguments.

@talentedmrjones
Copy link

B
B
A

But a space before ( and after )

function throwWaterBalloon (person, size) {

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment