Created
April 25, 2020 11:23
-
-
Save ins77/c89ecdb0981d8a35716909b05f7f469c to your computer and use it in GitHub Desktop.
Revisions
-
ins77 created this gist
Apr 25, 2020 .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,14 @@ const magic = (...rest) => { const sum = rest.reduce((acc, current) => acc + current, 0); const inner = (...args) => { return magic(inner.valueOf(), ...args); }; inner.valueOf = () => sum; return inner; }; magic(5, 2, -9).valueOf(); magic(5, 2, -8)(4) + 2;