Created
September 4, 2021 12:30
-
-
Save wkdalsgh192/d3a274c7632be44d33c4526768bf07ae to your computer and use it in GitHub Desktop.
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
// 2. Pass a function as a parameter | |
function sayHello() { | |
return "Hello, "; | |
} | |
function greeting(helloMessage, name) { | |
console.log(helloMessage() + name); | |
} | |
greeting(sayHello, "JavaScript!"); | |
// 3. Return a function | |
function sayHello() { | |
return function() { | |
console.log("Hello!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment