Skip to content

Instantly share code, notes, and snippets.

@FabioAntunes
Created March 25, 2018 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FabioAntunes/3a5fe9da7bc7492f85fc961751ebc6bd to your computer and use it in GitHub Desktop.
Save FabioAntunes/3a5fe9da7bc7492f85fc961751ebc6bd to your computer and use it in GitHub Desktop.
let addOne
function add(x, y) { return x + y }
addOne = add.bind(null, 1)
addOne = x => add(1, x)
// new syntax
addOne = add(1, ?)
// all of the previous examples are equivalent
addOne(4) //=> 5
function concat(x, y, z) { return x + y + z }
const pad = concat('****', ?, '****')
pad('sup') //=> '****sup****'
const f = (x, ...y) => [x, ...y]
const g = f(?, 1, ...)
g(2, 3, 4); //=> [2, 1, 3, 4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment