- 규칙
(1) 자음이 없으며 y를 제외한 모음만 있음
(2) u와 e는 다른 모음보다 길기 때문에 2배로 늘려야 함
(3) 고래어는 하나의 대문자 string 으로 출력되어야 함
(4) 인간어 : Life is a sum of all our choices
let human = 'life is a sum of all our choices';
let vowle = ['a', 'e', 'i', 'o', 'u'];
let dolphin = [];
for (let i = 0; i < human.length; i++) {
for (let j = 0; j < vowle.length; j++) {
if (human[i] === vowle[j]) {
if(human[i] === 'u') {
dolphin.push('uu');
} else if (human[i] === 'e') {
dolphin.push('ee');
} else {
dolphin.push(human[i]);
}
}
}
}
console.log(dolphin.join('').toUpperCase());
IEEIAUUOAOUUOIEE