0

In Trevor Burnham's book on Coffeescript (p81) he has

newcard.save().then =>
    ...

Which is not part of a conditional or a switch statement. Is then just a joining word for the syntax or does it have a semantic purpose?

iainH
  • 1,044
  • 10
  • 19

2 Answers2

1

It calls the newcard.save().then function, passing a function. It is equivalent to the following ECMAScript 6 code:

newcard.save().then(() => { ... })
0

Of course ... It calls the newcard.save().then function - thanks @rightfold - which is in the Angular.js promises api. Not immediately obvious out of context of that api which BTW is nicely explained here.

iainH
  • 1,044
  • 10
  • 19