Guest User

Untitled

a guest
Dec 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. function endSentenceWithYo(template, ...expressions) {
  2. return template.reduce((accumulator, part, i) => {
  3. return accumulator + expressions[i - 1] + part
  4. }) + ", yo!"
  5. }
  6.  
  7. let type = 'delivery guy';
  8. let name = 'Barry';
  9. let says = 'Here ye go';
  10.  
  11. var template = endSentenceWithYo`The ${type} ${name} says: ${says}`;
  12.  
  13. console.log(template);
Add Comment
Please, Sign In to add comment