function removeVowelKeys(object) {
const isVowel = char => ['a', 'e', 'i', 'o', 'u', 'y'].includes(char.toLowerCase());
const result = {...object};
Object.getOwnPropertyNames(object).forEach(propertyName => {
const firstChar = propertyName.charAt(0);
if (isVowel(firstChar)) {
delete result[propertyName];
}
});
return result;
}
alert(JSON.stringify(removeVowelKeys({
alarm: 'This is SPARTA!!!',
chip: 100,
isValid: false,
Advice: 'Learn it hard',
onClick: 'make it great again',
})));