ErolKZ

Untitled

Nov 14th, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1.  
  2. function solve (arr) {
  3.  
  4. let str = arr[0];
  5.  
  6. let strArr = arr[0].split(' ');
  7.  
  8. // strArr = strArr.filter(el => el !== '.' && el !== ',');
  9.  
  10. let arr2 = arr[1];
  11.  
  12. // console.log(strArr);
  13.  
  14.  
  15. for (let el of strArr) {
  16.  
  17. if (!el.match(/[A-Z]/i)) {
  18.  
  19. el = el.split('').filter(el3 => el3 === '_');
  20.  
  21. el = el.join('');
  22.  
  23. arr2.forEach(el2 => el2.length === el.length ? str = str.replace(el, el2) : false);
  24.  
  25. }
  26.  
  27. }
  28.  
  29.  
  30. console.log(str);
  31.  
  32.  
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment