Skip to content

Instantly share code, notes, and snippets.

@yurist38
Created May 11, 2019 08:11
Show Gist options
  • Save yurist38/31ac4f33d69532960c0d18de2838fe08 to your computer and use it in GitHub Desktop.
Save yurist38/31ac4f33d69532960c0d18de2838fe08 to your computer and use it in GitHub Desktop.
function addN(base: number): (a: number) => number {
let baseNumber = base;
return (addition: number): number => baseNumber + addition;
}
const addEight = addN(8);
console.log(addEight(7)); // 15
console.log(addEight(100)); // 108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment