Created
April 2, 2019 00:03
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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