Casey Becking
Casey Becking

Reputation: 137

function inside functions in coffeescript

How do I write this in coffee script?

function setUpDialogForms() {
    setUpListForm();
    setUpUpdateForm();
}

I have tried

setUpDialogForms -> setUpListForm(); setUpUpdateForm()

Upvotes: 1

Views: 2105

Answers (2)

Casey Becking
Casey Becking

Reputation: 137

Found it out.

setUpDialogForms = () -> 
    setUpListForm() 
    setUpUpdateForm()
    return

Which returns

var setUpDialogForms;

setUpDialogForms = function() {
  setUpListForm();
  setUpUpdateForm();
};

Upvotes: 1

rjz
rjz

Reputation: 16510

Provided the setUpListForm and setUpUpdateForm functions are defined somewhere, you can use:

setUpDialogForms = ->
  setUpListForm()
  setUpUpdateForm()

setUpDialogForms()

Upvotes: 4

Related Questions