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
const pipe = require("ramda").pipe; // node or webpack/browserify | |
const firstInitial = pipe(getFirstName, getFirstLetter); |
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
const getFirstName = person => person.split(" ")[1]; // second word | |
const getFirstLetter = string => string[0]; // first letter | |
const getFirstInitial = person => { | |
return getFirstLetter(getFirstName(person)); // nested function! | |
} | |
// try it | |
getFirstInitial("Doc Emmett Brown"); // "E" |
NewerOlder