small medium large xlarge

Back to: All Forums  CoffeeScript
Generic-user-small
15 Feb 2012, 22:52
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);
Trevor_burnham__goofy_headshot__pragsmall
16 Feb 2012, 15:41
Trevor Burnham (54 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. :)

Generic-user-small
16 Feb 2012, 16:47
Achim (6 posts)

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

Generic-user-small
16 Feb 2012, 21:18
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”?

Trevor_burnham__goofy_headshot__pragsmall
22 Feb 2012, 19:45
Trevor Burnham (54 posts)

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

Generic-user-small
22 Feb 2012, 23:30
Achim (6 posts)

Thank you!

  You must be logged in to comment