-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Manish Jain
authored and
Manish Jain
committed
Apr 26, 2017
1 parent
b472847
commit a6a9fe8
Showing
3 changed files
with
31 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
javascript-concept-practice/javascript-advance/JavaScript-currying-functions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict' | ||
|
||
var avg = function(...n){ | ||
let tot = 0; | ||
for(let i = 0 ; i < n.length ; i++){ | ||
tot += n[i] | ||
} | ||
|
||
return tot/n.length; | ||
} | ||
|
||
var spiceUp = function(fn,...n){ | ||
return function(...m){ | ||
return fn.apply(this,n.concat(m)); | ||
};; | ||
} | ||
|
||
var doAvg = spiceUp(avg,1,2,3); | ||
console.log(doAvg(4,5,6)); | ||
|
||
var sayWhat = function(a){ | ||
return function(b){ | ||
return function(c){ | ||
console.log('saying ',a,' to ',b,' using ',c); | ||
} | ||
} | ||
} | ||
|
||
sayWhat('hello')('toFriends')('javaScript') |
This file was deleted.
Oops, something went wrong.