-
-
Save 4knort/f206ec0cfc79b35d2fbf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deleteLetter(str) { | |
// Напишите функцию removeLetters, которая удаляет все гласные буквы из переданной ей строки. | |
// removeLetters('This is string'); // вернет "Ths s strng" | |
// removeLetters('THIS IS STRING'); // вернет "THS S STRNG" | |
var string = str.split(''); | |
var arr = []; | |
var result = ''; | |
var letters = ['a', 'e', 'i', 'o', 'u', 'y']; | |
for ( var i = 0; i < string.length; i++) { | |
for ( var j = 0; j < letters.length; j++){ | |
if (string[i] === letters[j]) { | |
return | |
} | |
else { | |
arr.push(string[i]); | |
result += arr[i]; | |
} | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment