Last active
February 7, 2019 10:06
Revisions
-
CodeDotJS revised this gist
Feb 7, 2019 . No changes.There are no files selected for viewing
-
CodeDotJS created this gist
Feb 4, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ 'use strict'; const reverseVowelString = s => { let str = s.split(''); const voewls = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']; const storeVowelsFromString = []; for (let i = 0; i <= str.length - 1; i++) { for (let j = 0; j <= voewls.length - 1; j++) { if (str[i] === voewls[j]) { storeVowelsFromString.push(str[i]); str[i] = '_'; } } } const revStr = storeVowelsFromString.reverse(); let index = 0; return str.map(a => a === "_" ? revStr[index++] : a).join(''); }; console.log(reverseVowelString('ENTREPRENEURIAL'));