2010-01-26 15:52:05 +00:00
|
|
|
a: [(x) -> x, (x) -> x * x]
|
2009-12-30 23:09:43 +00:00
|
|
|
|
2010-02-17 00:45:25 +00:00
|
|
|
ok a.length is 2
|
2010-01-01 14:49:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
regex: /match/i
|
|
|
|
words: "I think there is a match in here."
|
|
|
|
|
2010-02-17 00:45:25 +00:00
|
|
|
ok !!words.match(regex)
|
2010-01-01 15:17:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
neg: (3 -4)
|
|
|
|
|
2010-02-17 00:45:25 +00:00
|
|
|
ok neg is -1
|
2010-01-07 02:21:42 +00:00
|
|
|
|
|
|
|
|
2010-01-26 15:52:05 +00:00
|
|
|
func: ->
|
2010-01-07 02:21:42 +00:00
|
|
|
return if true
|
|
|
|
|
2010-02-17 00:45:25 +00:00
|
|
|
ok func() is null
|
2010-01-07 04:15:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
str: "\\"
|
|
|
|
reg: /\\/
|
|
|
|
|
2010-02-17 00:45:25 +00:00
|
|
|
ok reg(str) and str is '\\'
|
2010-01-09 16:58:50 +00:00
|
|
|
|
|
|
|
|
2010-01-10 20:52:23 +00:00
|
|
|
money$: 'dollars'
|
|
|
|
|
2010-02-17 00:45:25 +00:00
|
|
|
ok money$ is 'dollars'
|
2010-02-03 01:36:46 +00:00
|
|
|
|
|
|
|
|
2010-02-17 00:45:25 +00:00
|
|
|
ok {a: (num) -> num is 10 }.a 10
|
2010-02-16 00:13:08 +00:00
|
|
|
|
|
|
|
|
2010-02-03 01:36:46 +00:00
|
|
|
bob: {
|
|
|
|
name: 'Bob'
|
|
|
|
greet: (salutation) ->
|
|
|
|
salutation + " " + @name
|
|
|
|
hello: ->
|
2010-02-21 01:09:52 +00:00
|
|
|
@['greet'] "Hello"
|
2010-02-08 16:48:43 +00:00
|
|
|
10: 'number'
|
2010-02-03 01:36:46 +00:00
|
|
|
}
|
|
|
|
|
2010-02-17 00:45:25 +00:00
|
|
|
ok bob.hello() is "Hello Bob"
|
|
|
|
ok bob[10] is 'number'
|
2010-02-16 13:43:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
obj: {
|
|
|
|
'is': -> yes
|
|
|
|
'not': -> no
|
|
|
|
}
|
|
|
|
|
2010-02-17 00:45:25 +00:00
|
|
|
ok obj.is()
|
|
|
|
ok not obj.not()
|