2010-01-26 10:52:05 -05:00
|
|
|
func: (first, second, rest...) ->
|
2010-01-24 23:40:45 -05:00
|
|
|
rest.join ' '
|
2009-12-31 17:50:12 -05:00
|
|
|
|
2010-01-24 23:40:45 -05:00
|
|
|
result: func 1, 2, 3, 4, 5
|
2009-12-31 17:50:12 -05:00
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok result is "3 4 5"
|
2009-12-31 19:52:13 -05:00
|
|
|
|
|
|
|
|
|
|
|
gold: silver: bronze: the_field: null
|
|
|
|
|
2010-01-26 10:52:05 -05:00
|
|
|
medalists: (first, second, third, rest...) ->
|
2009-12-31 19:52:13 -05:00
|
|
|
gold: first
|
|
|
|
silver: second
|
|
|
|
bronze: third
|
|
|
|
the_field: rest
|
|
|
|
|
|
|
|
contenders: [
|
|
|
|
"Michael Phelps"
|
|
|
|
"Liu Xiang"
|
|
|
|
"Yao Ming"
|
|
|
|
"Allyson Felix"
|
|
|
|
"Shawn Johnson"
|
|
|
|
"Roman Sebrle"
|
|
|
|
"Guo Jingjing"
|
|
|
|
"Tyson Gay"
|
|
|
|
"Asafa Powell"
|
|
|
|
"Usain Bolt"
|
|
|
|
]
|
|
|
|
|
2010-01-24 23:40:45 -05:00
|
|
|
medalists "Mighty Mouse", contenders...
|
2009-12-31 19:52:13 -05:00
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok gold is "Mighty Mouse"
|
|
|
|
ok silver is "Michael Phelps"
|
|
|
|
ok bronze is "Liu Xiang"
|
2010-02-20 18:25:36 -05:00
|
|
|
ok the_field.length is 8
|
|
|
|
|
|
|
|
|
|
|
|
obj: {
|
|
|
|
name: 'bob'
|
|
|
|
accessor: (args...) ->
|
|
|
|
[@name].concat(args).join(' ')
|
|
|
|
getNames: ->
|
|
|
|
args: ['jane', 'ted']
|
|
|
|
@accessor(args...)
|
|
|
|
}
|
|
|
|
|
|
|
|
ok obj.getNames() is 'bob jane ted'
|