Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function endSentenceWithYo(template, ...expressions) {
- return template.reduce((accumulator, part, i) => {
- return accumulator + expressions[i - 1] + part
- }) + ", yo!"
- }
- let type = 'delivery guy';
- let name = 'Barry';
- let says = 'Here ye go';
- var template = endSentenceWithYo`The ${type} ${name} says: ${says}`;
- console.log(template);
Add Comment
Please, Sign In to add comment