Skip to content

Instantly share code, notes, and snippets.

@dewey92
Last active June 27, 2017 02:19
Show Gist options
  • Select an option

  • Save dewey92/400c5ad7e84657c0c7c5b6dc604c4f98 to your computer and use it in GitHub Desktop.

Select an option

Save dewey92/400c5ad7e84657c0c7c5b6dc604c4f98 to your computer and use it in GitHub Desktop.
// add :: Number → Number → Number
const add = (x, y) => x + y
// mathMsg :: (Number → Number → Number) → Number → Number → String
const mathMsg = (mathOp, x, y) => {
const result = mathOp(x, y)
return `The result of ${x} and ${y} is ${result}`
}
console.log(mathMsg(add, 4, 5))
// => The result of 4 and 5 is 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment