12

CoffeeScript

Embed Size (px)

DESCRIPTION

How about a nice BIG cup of CoffeeScript

Citation preview

Page 1: CoffeeScript
Page 2: CoffeeScript
Page 3: CoffeeScript

"It's just JavaScript"

coated with syntax sugar

Page 4: CoffeeScript

CoffeeScript attempts to expose those 'good parts'

Didyounotice?

Page 5: CoffeeScript

#nuffsaidit's quite thin

Page 6: CoffeeScript

But its core is gooooood

Page 7: CoffeeScript

CoffeeScript attempts to expose those 'good parts'

CoffeeScript exposes those

'good parts'

Page 8: CoffeeScript

CoffeeScript attempts to expose those 'good parts'

Page 9: CoffeeScript

RubyPythonHaskell

Page 10: CoffeeScript

# prototypingString::downCase = -> @toLowerCase()

# functions, chained comparisonisMyAge = (age) ->

24 < age < 26

# splat arguments, pattern matchingunCapitalize = (words...) ->

(words.map ([firstChar, rest...]) -> firstChar.downCase() + rest.join '').join ''

# destructuring assignment, function bindingMe = ([surname, middlenames..., lastname] ) -> # string interpolation

@name = "#{surname} #{lastname}"

# everything is an expression@age = if isMyAge(x = 25) then x else '?' @twitter = unCapitalize('@', surname, lastname)

# use jQuery (or any JavaScript library), multi line Strings$('#welcome').bind 'click' (event) => alert "Hello,

I'm #{@name}!"# there's no var!!me = Me("Jeroen Matthijs Rosenberg".split ' ')

Page 11: CoffeeScript

#nuffsaid

Page 12: CoffeeScript

word.spread! for people in continents[..] when people isnt aware