2010-01-11 22:04:25 -05:00
|
|
|
a: -1
|
|
|
|
b: -2
|
|
|
|
|
|
|
|
[a, b]: [b, a]
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok a is -2
|
|
|
|
ok b is -1
|
2010-01-11 22:04:25 -05:00
|
|
|
|
|
|
|
|
2010-02-25 00:43:02 -05:00
|
|
|
func: ->
|
|
|
|
[a, b]: [b, a]
|
|
|
|
|
|
|
|
ok func().join(' ') is '-1 -2'
|
|
|
|
|
|
|
|
|
2010-02-25 07:31:33 -05:00
|
|
|
noop: ->
|
|
|
|
|
|
|
|
noop [a,b]: [c,d]: [1,2]
|
|
|
|
|
|
|
|
ok a is 1 and b is 2
|
|
|
|
|
|
|
|
|
2010-01-11 22:04:25 -05:00
|
|
|
arr: [1, 2, 3]
|
|
|
|
|
|
|
|
[a, b, c]: arr
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok a is 1
|
|
|
|
ok b is 2
|
|
|
|
ok c is 3
|
2010-01-11 22:04:25 -05:00
|
|
|
|
|
|
|
|
|
|
|
obj: {x: 10, y: 20, z: 30}
|
|
|
|
|
|
|
|
{x: a, y: b, z: c}: obj
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok a is 10
|
|
|
|
ok b is 20
|
|
|
|
ok c is 30
|
2010-01-11 22:04:25 -05:00
|
|
|
|
|
|
|
|
|
|
|
person: {
|
|
|
|
name: "Bob"
|
|
|
|
family: {
|
|
|
|
brother: {
|
|
|
|
addresses: [
|
|
|
|
"first"
|
|
|
|
{
|
|
|
|
street: "101 Deercreek Ln."
|
|
|
|
city: "Moquasset NY, 10021"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{name: a, family: {brother: {addresses: [one, {city: b}]}}}: person
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok a is "Bob"
|
|
|
|
ok b is "Moquasset NY, 10021"
|
2010-01-13 22:25:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
test: {
|
|
|
|
person: {
|
|
|
|
address: [
|
|
|
|
"------"
|
|
|
|
"Street 101"
|
|
|
|
"Apt 101"
|
|
|
|
"City 101"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{person: {address: [ignore, addr...]}}: test
|
|
|
|
|
2010-03-19 22:48:55 -04:00
|
|
|
ok addr.join(', ') is "Street 101, Apt 101, City 101"
|
|
|
|
|
|
|
|
|
|
|
|
[a, b]: if true then [2, 1] else [1, 2]
|
|
|
|
|
|
|
|
ok a is 2
|
|
|
|
ok b is 1
|