Skip to content

Instantly share code, notes, and snippets.

@jmaicaaan
Created September 30, 2021 14:17
Show Gist options
  • Save jmaicaaan/c2a6f4a0a8b1354ba46f5d394511697b to your computer and use it in GitHub Desktop.
Save jmaicaaan/c2a6f4a0a8b1354ba46f5d394511697b to your computer and use it in GitHub Desktop.
const sum = (x, y) => x + y;
/**
* We are sure that `sum(3, 3)` will *always* return `6`
* because the function `sum` is *pure*.
* No matter how many times we call it with the same input,
* it will produce the same output
*/
const six = sum(3, 3);
console.log('six', six); // 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment