// your code goes here//convert all vowels in the string to uppercase
function vowelToUppercase(s) {
return s.replace(/[aeiou]/g, (c) => c.toUpperCase());
}
console.log(vowelToUppercase('Hello Afnane'));
//reverse the string
function reverse(s){
return s.split('').reverse().join('');
}
console.log(reverse('Afnane'));
//Removing last char if consonant
function removeConsonant(s){
let lastChar = s.charAt(s.lenght - 1);
if (/[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]/.test(lastChar)){
return s.slice(0,-1);
}
return s;
}
console.log(removeConsonant('Hello Afnane'));
//magic function
function magic(s){
return s.split('').join('-');
}
console.log(magic('Hello Afnane'));
Ly8geW91ciBjb2RlIGdvZXMgaGVyZS8vY29udmVydCBhbGwgdm93ZWxzIGluIHRoZSBzdHJpbmcgdG8gdXBwZXJjYXNlCmZ1bmN0aW9uIHZvd2VsVG9VcHBlcmNhc2UocykgewoKICAgIHJldHVybiBzLnJlcGxhY2UoL1thZWlvdV0vZywgKGMpID0+IGMudG9VcHBlckNhc2UoKSk7Cn0KCmNvbnNvbGUubG9nKHZvd2VsVG9VcHBlcmNhc2UoJ0hlbGxvIEFmbmFuZScpKTsKCi8vcmV2ZXJzZSB0aGUgc3RyaW5nCmZ1bmN0aW9uIHJldmVyc2Uocyl7CiAgICByZXR1cm4gcy5zcGxpdCgnJykucmV2ZXJzZSgpLmpvaW4oJycpOwp9Cgpjb25zb2xlLmxvZyhyZXZlcnNlKCdBZm5hbmUnKSk7CgovL1JlbW92aW5nIGxhc3QgY2hhciBpZiBjb25zb25hbnQKZnVuY3Rpb24gcmVtb3ZlQ29uc29uYW50KHMpewogICAgbGV0IGxhc3RDaGFyID0gcy5jaGFyQXQocy5sZW5naHQgLSAxKTsKICAgIGlmICgvW2JjZGZnaGprbG1ucHFyc3R2d3h5ekJDREZHSEpLTE1OUFFSU1RWV1hZWl0vLnRlc3QobGFzdENoYXIpKXsKICAgICAgIHJldHVybiAgcy5zbGljZSgwLC0xKTsKICAgIH0KICAgIHJldHVybiBzOwp9Cgpjb25zb2xlLmxvZyhyZW1vdmVDb25zb25hbnQoJ0hlbGxvIEFmbmFuZScpKTsKLy9tYWdpYyBmdW5jdGlvbgpmdW5jdGlvbiBtYWdpYyhzKXsKICAgIHJldHVybiBzLnNwbGl0KCcnKS5qb2luKCctJyk7CiAgICAKfQoKY29uc29sZS5sb2cobWFnaWMoJ0hlbGxvIEFmbmFuZScpKTs=