3 ms·
a: 1 b: 2 obj: { a: 1 b: 2 } Quite right, and internally, both kinds of assignment compile into a CoffeeScript AssignNode. The latter
by jashkenas 17y ago
a: 1
b: 2
obj: {
a: 1
b: 2
}
Quite right, and internally, both kinds of assignment compile into a CoffeeScript AssignNode. The latter is just tagged as occurring within an object literal. Having the commas be optional in multiline objects also helps make both kinds of assignment look identical.
(And I'm calling it assignment because saying "binding" in JavaScript usually means that you're binding a function to a "this" context object)
- nir 17y agoAny chance you'll allow equal sign as well as colon? For all of us coders conditioned by years of programming to automatically use "="... Looks beautiful, in any case.