Last active
April 9, 2017 02:52
-
-
Save Tan-Moy/48db724fbb5ea0c0fb123ecf3c6232b4 to your computer and use it in GitHub Desktop.
This file contains 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
//the function from before | |
function sum(number1, number2) { | |
console.log(number1 + number2); | |
} | |
//sum(2, 1); //3 | |
//new function that takes 3 parameters | |
function doesSomething(parameter1, parameter2, parameter3) { //again we define a function with 3 parameters | |
console.log('This is parameter 1: ',parameter1); //print parameter 1 | |
console.log('This is parameter 2: ',parameter2);//print parameter 2 | |
console.log('The result is:'); | |
parameter3(parameter1,parameter2); //invoke parameter 3 and pass on parameter 1 and parameter 2 as arguments | |
} | |
doesSomething(4,5,sum); //invoke the function, prints out 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment