Advertisement
bebo231312312321

Untitled

Mar 18th, 2023
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function rageQuit (input){
  2.     let regexString = /[^\d]+/g;
  3.     let regexNum = /[\d]+/g;
  4. input = input.shift()
  5.    
  6.     let finalString = '';
  7.    
  8.     let txt = input.match(regexString);
  9.     let num = input.match(regexNum);
  10.  
  11.     for(let i = 0; i < txt.length; i++){
  12.        
  13.        
  14.         let messag = txt[i].toUpperCase();
  15.         let number = Number(num[i]);
  16.         finalString += messag.repeat(number);
  17.       }
  18.         // for (let el of a){
  19.         //     uniqueSymbols[el] = 0;
  20.         // }
  21.  
  22.         // let addToFinalString = '';
  23.         // for(let j = 1; j <= Number(num[i]); j++) {
  24.         //     addToFinalString += a;
  25.         // }
  26.        // finalString +=
  27.    
  28.        let uniqueSymbols = new Set (finalString).size
  29.       // console.log(uniqueSymbols)
  30. //let finalUniqueSymbols = Object.keys(uniqueSymbols);
  31.  
  32.     console.log(`Unique symbols used: ${uniqueSymbols}`);
  33.     console.log(finalString);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement