Skip to content

Instantly share code, notes, and snippets.

@Phongtlam
Created May 30, 2017 16:58
Show Gist options
  • Save Phongtlam/01bebf30a1bcce7c090b2638456c0b8c to your computer and use it in GitHub Desktop.
Save Phongtlam/01bebf30a1bcce7c090b2638456c0b8c to your computer and use it in GitHub Desktop.
// ['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','?']
function isVowel(x) {
var result;
result = x === "a" || x === "e" || x === "i" || x === "o" || x === "u";
return result;
}
function doubleV(array) {
var result = [];
for (var i = 0; i < array.length; i++) {
if (isVowel(array[i])) {
result.push(array[i], array[i])
} else {
result.push(array[i]);
}
}
return result;
}
doubleV(['w','h','a','t',' ','o','n'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment