Last active
August 29, 2015 14:19
-
-
Save olegakbarov/78cb289c4c938d13bf7e to your computer and use it in GitHub Desktop.
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
// наивная реализация выглядит вот так: | |
function Inherit(object, parent) { | |
for (var key in parent) { | |
object[key] = parent[key] | |
} | |
} | |
/* | |
для любого sum(1)(2)(3)...(n) == m | |
*/ | |
function sum (a) { | |
var res = function (b) { | |
return sum (a + b); | |
}; | |
res.valueOf = res.toString = function () { | |
return a; | |
}; | |
return res; | |
} | |
console.log(+sum(1)(2)(3)(4)(5)(10)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment