Skip to content

Commit e8dffdd

Browse files
committed
splat function
1 parent b3abc54 commit e8dffdd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

splat.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function splat(fun) {
2+
return function (array) {
3+
return fun.apply(null, array)
4+
}
5+
}
6+
var addArrayElements = splat(function (x, y) {
7+
return x + y
8+
})
9+
addArrayElements

0 commit comments

Comments
 (0)