let print = s => console.log(s);
function remove_vowels(s) {
let res = '';
for(let i of s) {
if(i != 'a' && i != 'e' && i != 'i' && i != 'o' && i != 'u') res += i;
}
return res;
}
let str = 'Twinkle, twinkle, little star';
print(remove_vowels(str));
function disemvowel(str) {
const vowels = ['a', 'e', 'i', 'o', 'u'];
return str
.split('')
.filter(char => !vowels.includes(char))
.join('');
}
console.log(disemvowel('Twinkle, twinkle, little star, How I wonder what you are.'));
// Twnkl, twnkl, lttl str, Hw I wndr wht y r.
let replace = '[aeuio]';
let regExp = new RegExp(replace, "gi");
function getDividers(num, divider) {
return num === 1
? []
: num % divider
? getDividers(num, divider + 1)
: [ divider, ...getDividers(num / divider, divider) ];
}
function showDividers(num) {
if (!Number.isInteger(num) || num < 2) {
throw 'fuck off';
}
console.log(`${num} = ${getDividers(num, 2).join(' * ')}`);
}