Skip to content

Instantly share code, notes, and snippets.

@tomdale
Created April 24, 2012 16:44
Show Gist options
  • Save tomdale/2481356 to your computer and use it in GitHub Desktop.
Save tomdale/2481356 to your computer and use it in GitHub Desktop.
One CoffeeScript ambiguity
App.messageController = Ember.Object.create
message: "Hello, world!"
# Compiles to:
# App.messageController = Ember.Object.create({
# message: "Hello, world!"
# });
# Okay, let's refactor it and delete the message property:
App.messageController = Ember.Object.create
# Compiles to:
# App.messageController = Ember.Object.create
# Oops, your controller is now the Ember.Object#create function!
@alexgorbatchev
Copy link

same as

return {
  foo: 123
}

and

return
{
  foo: 123
}

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment