Advertisement
BojidarDosev

whale language

Mar 10th, 2024
671
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let input='turpentine and turtles';
  2. const vowels = ['a','e','i','o','u'];
  3. let resultArray = [];
  4. let resultString = [];
  5. for(let i = 0; i<input.length; i++)
  6. {
  7.   for(let j = 0; j<vowels.length;j++)
  8.   {
  9.     if(input[i]===vowels[j])
  10.     {
  11.       if(input[i]==='e' || input[i] ==='u')
  12.       {
  13.         resultArray.push(input[i]);
  14.         resultArray.push(input[i]);
  15.       }
  16.       else resultArray.push(input[i]);
  17.      
  18.     }
  19.   }
  20.   //console.log(i);
  21. }
  22.  
  23. for(let i = 0; i<resultArray.length;i++)
  24. {
  25.   console.log(resultArray[i]);
  26. }
  27. resultString = resultArray;
  28. console.log(resultString.join("").toUpperCase());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement