Skip to content

Instantly share code, notes, and snippets.

@glenjamin
Created August 10, 2013 10:27
Show Gist options
  • Save glenjamin/6199934 to your computer and use it in GitHub Desktop.
Save glenjamin/6199934 to your computer and use it in GitHub Desktop.
Semi-colons I consider extraneous noise in JavaScript
// When assigning a function to a variable
var times = function(n, f) {
for (var i=0; i<n; ++i) {
f();
}
}/*here*/
// When there's only one expression in a function
function(callback) {
doSomething(function(err, n) { callback(err, n * 2)/*here*/ })/*and here*/
}
// When nesting functions that accept functions
describe("semi", function() {
describe("colons", function() {
it("aren't", function(){
assert.ok(true);
})/*here*/
it("really", function(){
assert.equals(';', ";");
})/*here*/
it("necessary", function(){
assert.throws(function() {
throw new Error(";;;;;");
})/*here*/
})/*here*/
})/*here*/
})/*here*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment