B
B
Bogdan2017-04-12 22:11:05
JavaScript
Bogdan, 2017-04-12 22:11:05

Is CoffeeScript a global function?

Hello. I decided to transfer the project on Ruby on Rail from JS to CoffeeScript, and then there was a problem with the scope of functions. A function declared in one file is not visible in another. As I understand it, this is due to the closure area that is created when compiling from CoffeeScript to JS

(function() {
  var beginning_of_month;

  beginning_of_month = function() {
    return console.log("test");
  };

}).call(this);

Can you please tell me the solution to this problem? Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2017-04-12
@werty1001

Global scope variable assignment and access for cof...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question