Skip to content

Instantly share code, notes, and snippets.

@knarf-se
knarf-se / semicolons-matter.js
Created June 17, 2011 15:16 — forked from jbgo/semicolons-matter.md
When using semicolons in JavaScript matters
// This fails in firefox, chrome, and maybe others.
// Add a semicolon after foo() and to eliminate the error.
function foo() { /* code goes here */ }
foo() // no semi-colon here
(function() { /* anonymouse function */ })() // bork!
//You can also write the closure like this instead of putting a semicolon after foo:
//!function() { /* anonymouse function */ }() // bork!