Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JacksonRMC/cb1ef2f4c5b1d72b55776b0d8cb3bee3 to your computer and use it in GitHub Desktop.
Save JacksonRMC/cb1ef2f4c5b1d72b55776b0d8cb3bee3 to your computer and use it in GitHub Desktop.
var doubleVowels = function(array) {
var vowels = ['a','e','i','o','u'];
for ( var i = 0 ; i < array.length ; i ++) {
if ( vowels.includes(array[i]) ) {
array.splice(i, 0, array[i]);
i ++;
}
}
return array;
}
var starting = ['w','h','a','t',' ','o','n',' ','e','a','r','t','h',' ','a','r','e',' ','y','o','u',' ','t','a','l','k','i','n','g',' ','a','b','o','u','t','?']
var ending = ['w','h','a','a','t',' ','o','o','n',' ','e','e','a','a','r','t','h',' ','a','a','r','e','e',' ','y','o','o','u','u',' ','t','a','a','l','k','i','i','n','g',' ','a','a','b','o','o','u','u','t','?']
console.log(doubleVowels(starting));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment