บังเอิญไปเจอ Blog ของ Oliver Steele ซึ่งเค้าไปทำ Functional JavaScript ไว้ ลองมาดูตัวอย่างที่เค้าทำให้ดูละกัน
map(function(x){return x+1}, [1,2,3]) -> [2,3,4] filter(function(x){return x>2}, [1,2,3,4]] -> [3,4] some(function(w){return w.length < 3}, 'are there any short words?'.split(' ')) -> false // double the items in a list: map('*2', [1,2,3]) -> [2, 4, 6] // find just the odd numbers: filter('%2', [1,2,3,4]) -> [1, 3] // or just the evens: filter(not('%2'), [1,2,3,4]) -> [2, 4]
ทั้งนี้เค้ายังได้ทำ API documentation ไว้ให้อ่านและศึกษากันด้วย



Recent comments
2 weeks 1 day ago
6 weeks 3 days ago
6 weeks 6 days ago
19 weeks 13 hours ago
24 weeks 1 day ago
38 weeks 4 days ago
43 weeks 16 hours ago
43 weeks 6 days ago
49 weeks 9 hours ago
51 weeks 3 days ago