Skip to content

Instantly share code, notes, and snippets.

@jlfwong
Created December 10, 2013 22:08
Show Gist options
  • Save jlfwong/7901153 to your computer and use it in GitHub Desktop.
Save jlfwong/7901153 to your computer and use it in GitHub Desktop.
Automatic Semicolon Insertion - Scala vs JavaScript
var foo = function() { console.log("foo"); };
var bar = function() { console.log("bar"); };
(foo())
(bar())
/*
Ouput:
(bar())
^
TypeError: undefined is not a function
at Object.<anonymous> (/private/tmp/foo.js:5:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
*/
def foo() { println("foo") }
def bar() { println("bar") }
(foo())
(bar())
/*
Output:
foobar
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment