/**
* @param {string} s
* @return {string}
*/
var reverseVowels = function (s) {
const vowels = "aeiouAEIOU";
const strArray = s?.split("");
let vowelsInString = [];
for (let i = 0; i < strArray.length; i++) {
if (vowels.includes(strArray[i])) {
vowelsInString.push(strArray[i]);
}
}
vowelsInString = vowelsInString.reverse();
for (let i = 0; i < strArray.length; i++) {
if (vowels.includes(strArray[i])) {
strArray[i] = vowelsInString.shift();
}
}
return strArray?.join("");
};
reverseVowels("aA");