Created
May 30, 2017 16:58
-
-
Save Phongtlam/01bebf30a1bcce7c090b2638456c0b8c to your computer and use it in GitHub Desktop.
This file contains 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 characters
// ['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