Slide 10
Slide 10 text
# prototyping
String::downCase = -> @toLowerCase()
# functions, chained comparison
isMyAge = (age) ->
24 < age < 26
# splat arguments, pattern matching
unCapitalize = (words...) ->
(words.map ([firstChar, rest...]) -> firstChar.downCase() + rest.join '').join ''
# destructuring assignment, function binding
Me = ([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 ' ')