Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(template, text) {
- let words = template.split(', ')
- for (let word of words) {
- text = text.replace('*'.repeat(word.length), word)
- }
- console.log(text)
- }
- // function solve(template, string) {
- // let arr = string.split(' ');
- // for (let word of arr) {
- // if (word.startsWith('*')) {
- // for (let temp of template.split(', ')) {
- // if (word.length == temp.length) {
- // arr.splice(arr.indexOf(word), 1, temp)
- // }
- // }
- // }
- // }
- // console.log(arr.join(' '))
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement