CoffeeScript, day 1

Day 1 of learning CoffeeScript.

I won’t lie. After I’ve spent about 30 minutes so far reading up on the documentation for CoffeeScript and my head is starting to spin.

I’m trying to decode some of the syntactic sugar that CoffeeScript provides, but even one liners are tripping me up right now:

really means:

and what’s more confusing is that there is even shorthand for this where somehow:

means this:

I know that there’s going to be a lot of getting used to, but so far this is just making my head dizzy.

What I like:

String interpolation

The way I think about string interpolation is string concatenation done easier (or maybe done right? does syntactic sugar mean that it’s more right?). I suspect as I learn CoffeeScript more, there are going to be more of these “that’s cool” moments.

whose JavaScript equivalent is:

Splats

Wow…that’s neat. When used as an argument in a function it basically is an array of values. What makes it cool is that you can surround it with variables and it’ll just slurp up all the other arguments and put it into an array.

Output:
one
two three four
five

It’s like it splats together variables into an array.

4 thoughts on “CoffeeScript, day 1

  1. Hello blogger, i must say you have high quality posts here.
    Your page should go viral. You need initial traffic boost
    only. How to get it? Search for: Mertiso’s tips go viral

  2. I have noticed you don’t monetize your website, don’t waste your traffic, you can earn additional
    cash every month because you’ve got hi quality content.
    If you want to know how to make extra money, search for:
    Mrdalekjd methods for $$$

Leave a Reply

Your email address will not be published. Required fields are marked *