Created
November 27, 2018 04:28
-
-
Save hacktember/c85e046cef6325d383a80b93102925d3 to your computer and use it in GitHub Desktop.
Example function in JavaScript
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
function mergeTwoNamesIntoOneWithoutSpaces(speciesOne, speciesTwo) { | |
// speciesOne and speciesTwo are variables; by defining what happens to the | |
// variables in a function, it lets us transform anything (of a compatible data type) | |
// that we pass into the function | |
// whatever we "return" is what the function spits out | |
return speciesOne + speciesTwo; | |
} | |
var animalOne = "Pig"; | |
var animalTwo = "Dog"; | |
var animalThree = mergeTwoNamesIntoOneWithoutSpaces(animalOne, animalTwo); // animalThree should be "PigDog" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment