15 Feb 2012, 22:52
Generic-user-small

Achim (6 posts)

Why does this not run with coffee File. I have node.js on windows:

singers =                  
     Jagger: "Rock"
     Elvis: "Roll"

if Jagger of singers
   console.log singers.Jagger

It runs not but compiles perfect to javascript’s:

var singers;

singers = {
  Jagger: "Rock",
  Elvis: "Roll"
};

if (Jagger in singers) console.log(singers.Jagger);
16 Feb 2012, 15:41
Trevor_burnham__goofy_headshot__pragsmall

Trevor Burnham (51 posts)

Ah, you made one small mistake: You wrote @if Jagger of singers@ when what you meant was @if “Jagger” of singers@. That’s why the compiled JavaScript produced the runtime error “ReferenceError: Jagger is not defined.”

You can usually get answers to these sorts of questions more quickly by posting them to Stack Overflow. :)

16 Feb 2012, 16:47
Generic-user-small

Achim (6 posts)

Thank you. Only a little mistake that i made :)

16 Feb 2012, 21:18
Generic-user-small

Achim (6 posts)

@Trevor: What mean you with “by posting them to Stack Overflow.” ? Mean you that i should opening a new topic with the headline “Stack Overflow”?

22 Feb 2012, 19:45
Trevor_burnham__goofy_headshot__pragsmall

Trevor Burnham (51 posts)

I’m referring to the Q&A site Stack Overflow, where people often ask CoffeeScript questions: http://stackoverflow.com/

22 Feb 2012, 23:30
Generic-user-small

Achim (6 posts)

Thank you!

  You must be logged in to comment