0
a = 5
do (a) ->
    console.log a

Why does this compile to

a = 5;
(function(a){
  return console.log(a);
})();

a is not passed in so it is undefined. Am I doing self executing closure wrong?

Farzher
  • 13,934
  • 21
  • 69
  • 100

1 Answers1

3

In LiveScript, do just invokes a function. You're looking for let :

let a
  console.log a
Ven
  • 19,015
  • 2
  • 41
  • 61