Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fxcosta/c29a67c213a8f437bdf09ad80bf31019 to your computer and use it in GitHub Desktop.
Save fxcosta/c29a67c213a8f437bdf09ad80bf31019 to your computer and use it in GitHub Desktop.
portugueseHello = function () {
return "Olá, ";
}
englishHello = function () {
return "Hello, ";
}
francaisHello = function () {
return "Bonjour, ";
}
function helloWorld(languageFunction, name) {
// return `${languageFunction()} ${name}`; utilizando Template Literals do ES6+
return languageFunction() + name;
}
helloWorld(portugueseHello, "Felix"); // output: Olá, Felix
helloWorld(englishHello, "Felix"); // output: Hello, Felix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment