Skip to content

Instantly share code, notes, and snippets.

@keithelliott
Created August 14, 2012 14:16
Show Gist options
  • Save keithelliott/3349663 to your computer and use it in GitHub Desktop.
Save keithelliott/3349663 to your computer and use it in GitHub Desktop.
Example of JavaScript statements
// End each statement with a semicolon
// example 1 - var that is assigned to a function
var foo = function(){
// do some stuff
}; // semicolon required to end statement
// Example 2 - no semicolon needed
function fooBar(){
return {
foo1: function(){
//do stuff
}, // comma instead of semicolon
bar1: function(){
//do stuff
} // no comma or semicolon
};
} // no semicolon required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment