jashkenas--coffeescript/documentation/examples/splats.coffee

28 lines
414 B
CoffeeScript

gold = silver = rest = "unknown"
awardMedals = (first, second, others...) ->
gold = first
silver = second
rest = others
contenders = [
"Michael Phelps"
"Liu Xiang"
"Yao Ming"
"Allyson Felix"
"Shawn Johnson"
"Roman Sebrle"
"Guo Jingjing"
"Tyson Gay"
"Asafa Powell"
"Usain Bolt"
]
awardMedals contenders...
alert """
Gold: #{gold}
Silver: #{silver}
The Field: #{rest.join ', '}
"""