Skip to content

Instantly share code, notes, and snippets.

@fox1t
Created November 21, 2017 10:47
Show Gist options
  • Save fox1t/2392d54e874a74da1ddca8427f27b099 to your computer and use it in GitHub Desktop.
Save fox1t/2392d54e874a74da1ddca8427f27b099 to your computer and use it in GitHub Desktop.
Dummy test
// immagina che pippo e giggio siano due oggetti molto più complessi
// e che tu conosca la signature con la quale verrà lanciata la funzione callback di
// highGreetings. Non hai bisogno del primo parametro, ma solo del secondo.
const highGreetings = (fn) =>
fn('pippo', 'gigio')
// hai bisogno per forza di gigio
// una possibilità è:
highGreetings((_, y) => {
console.log(y)
})
// l'altra:
highGreetings((...args) => {
console.log(args[1])
})
// altrimenti alla vecchia:
highGreetings((x, y) => {
console.log(y)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment