Last active
March 31, 2019 11:05
-
-
Save nbeers22/e6f50bf688df1f5ac7956a921bd38957 to your computer and use it in GitHub Desktop.
Thinkful Functions
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
// Create a function called wisePerson that takes 2 arguments: wiseType and whatToSay. | |
// This function takes a block of text and presents it as a quote from the wise person. | |
// wiseType is the person the quote will be attributed to, and whatToSay is what the wise person will be quoted as saying. | |
// When called like this: wisePerson('goat', 'Hello world') should return the string 'A wise goat once said: "Hello world".' | |
const wisePerson = (wiseType, whatToSay) => `A wise ${wiseType} once said: "${whatToSay}"` | |
// Create a function that takes a single argument: whatToShout. | |
// The function should return an all-caps version of the string it's | |
// given with three exclamation points !!! at the end. | |
// Given the text shouter('as you can hear i am whispering'), | |
// the function should return "AS YOU CAN HEAR I AM WHISPERING!!!". | |
const whatToShout = str => `${toUpperCase(str)}!!!` | |
// Create a function called textNormalizer that takes a single argument: text. | |
// The function should return an all-lowercase string. Any spaces at the beginning | |
// or end of text should be stripped off. | |
// When called like this textNormalizer(" let's GO SURFING NOW everyone is learning | |
// how ") should return the value "let's go surfing now everyone is learning how". | |
const textNormalizer = text => { | |
let arr = text.split(" ").filter( element => element !== "" ); | |
return arr.join(" ").toLowerCase(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment