Skip to content

Instantly share code, notes, and snippets.

@ufocoder
Created October 31, 2018 11:03
Show Gist options
  • Select an option

  • Save ufocoder/e4331b01e8f60a50b33cb9a6b8e0932f to your computer and use it in GitHub Desktop.

Select an option

Save ufocoder/e4331b01e8f60a50b33cb9a6b8e0932f to your computer and use it in GitHub Desktop.
function rememberX (x) {
return function getX () {
return x;
};
}
// ES6 version might look like the following
// const rememberX = x => () => x;
const get42 = rememberX(42);
const get36 = rememberX(36);
const get18 = rememberX(18);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment