Created
August 28, 2019 07:56
-
-
Save kitcat-dev/ba421e1d028409ac33f79e99b3a2fa23 to your computer and use it in GitHub Desktop.
Revisions
-
kitcat-dev created this gist
Aug 28, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ const partialApply = (fn, arg1) => (arg2, arg3) => fn(arg1, arg2, arg3); const getAverageSalary = (profession, country) => { if (profession === 'programmer') { if (country === 'spain') return 2000; if (country === 'russia') return 1200; if (country === 'usa') return 8000; } } const getProgrammersSalaryByCountry = partialApply(getAverageSalary, 'programmer'); const salary1 = getProgrammersSalaryByCountry('spain'); const salary2 = getProgrammersSalaryByCountry('russia'); const salary3 = getProgrammersSalaryByCountry('usa'); console.log(salary1, salary2, salary3)