Created
August 14, 2012 14:16
-
-
Save keithelliott/3349663 to your computer and use it in GitHub Desktop.
Example of JavaScript statements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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