Skip to content

Instantly share code, notes, and snippets.

@dangolbeeker
Created April 2, 2019 00:03
Show Gist options
  • Save dangolbeeker/17b209734394643077613bd74d9a3086 to your computer and use it in GitHub Desktop.
Save dangolbeeker/17b209734394643077613bd74d9a3086 to your computer and use it in GitHub Desktop.
JS Assignment 15: Intro to Callbacks created by dangolbeeker - https://repl.it/@dangolbeeker/JS-Assignment-15-Intro-to-Callbacks
// Exercise One: In this exercise you will be creating two functions.
// Function One: Will be called 'multiply'.
// This function will take two parameters, both numbers
// This function will return the two numbers multiplied together.
function multiply(num1, num2) {
return num1 * num2;
}
// Function Two: Will be called 'calculator'.
// This function will take three parameters,
// First will be a callback function,
// Second and Third will be numbers.
// This function will return the two numbers passed into the callback function.
function calculator(cb,num1,num2){
return cb(num1,num2);
}
// NOTE: You can use the multiply function to test the calculator function, but understand that
// other callback functions will be passed into it as a test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment