Skip to content

Instantly share code, notes, and snippets.

@jrunning
Created November 30, 2012 17:07
Show Gist options
  • Select an option

  • Save jrunning/4177040 to your computer and use it in GitHub Desktop.

Select an option

Save jrunning/4177040 to your computer and use it in GitHub Desktop.
CoffeeScript object literal gotcha
# try it live: http://bit.ly/TwZV18
# CoffeeScript # JavaScript
foo # foo({
bar: 1 # bar: 1,
baz: 2 # baz: 2,
qux: 3 # qux: 3
# });
foo # foo({
bar: 1, # bar: 1,
baz: 2, # baz: 2,
qux: 3 # qux: 3
# });
foo bar: 1, # foo({
baz: 2, # bar: 1
qux: 3 # }, { # ... Welp.
# baz: 2,
# qux: 3
#});
foo bar: 1 #
baz: 2 # # Parse error
qux: 3 #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment