Advertisement
Todorov_Stanimir

01. Reveal Words

Jul 19th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. function revealWords(words, templates) {
  2. words = words.split(', ');
  3. templates = templates.split(' ');
  4.  
  5. for (let word of words) {
  6. for (let index in templates) {
  7. if (templates[index] === '*'.repeat(word.length)) {
  8. templates[index] = word;
  9. }
  10. }
  11. }
  12. let output = templates.join(' ');
  13. console.log(output);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement