Arrays as über-collections
// 34 new methods, 19 of which from Enumerable (4 slides away)...
[1, 2, 3].first() // 3
[4, 5, 6].last() // 6
[7, 8, 9].indexOf(8) // 1
[1, [2, 3], [4, [5], []]].flatten() // [1, 2, 3, 4, 5]
[1, null, , 2, null, 3].compact() // [1, 2, 3]
[1, 2, 3, 2, 1].without(1) // [2, 3, 2]
[1, 2, 3, 3, 4, 2, 5].uniq() // [1, 2, 3, 4, 5]
function greet() {
return 'Hey ' + $A(arguments).first() + '!';
}
greet('Sam', 'Thomas', 'John') // 'Hey Sam!'
$w('eenie meenie minie moe') // ['eenie', 'meenie', 'minie', 'moe']