Created
March 6, 2025 13:16
-
-
Save Babali42/40ccbde949e101e32d76b8af8cb86089 to your computer and use it in GitHub Desktop.
Exploration about currying in javascript
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 characters
function(a){ | |
return function () { | |
return 1 + a | |
} | |
} | |
function(a){ | |
return function ooo() { | |
return 1 + a | |
} | |
} | |
function test(a){ | |
return function() { | |
return 1 + a | |
} | |
} | |
undefined | |
test(1)() | |
2 | |
function add2(a){ | |
var mult = 2 | |
return function() { | |
return mult + a | |
} | |
} | |
undefined | |
add2(4)() | |
6 | |
add2(6)() | |
8 | |
function add(a){ | |
return function(mult) { | |
return mult + a | |
} | |
} | |
undefined | |
add(2)(4) | |
6 | |
var add2 = add(2); | |
undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment