js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

Solve 'Is there a vowel in there?' #272

Closed odv closed 5 years ago

odv commented 5 years ago

https://www.codewars.com/kata/is-there-a-vowel-in-there/train/javascript

RazvanBugoi commented 5 years ago
function isVow(a){
  const input = a;
  let output = [];

  for (let i = 0; i < input.length; i += 1) {
    if (input[i] === 97) {
      output.push(`${"a"}`);
      } else if (input[i] === 101) {
      output.push(`${"e"}`);
      } else if (input[i] === 105) {
      output.push(`${"i"}`);
      } else if (input[i] === 111) {
      output.push(`${"o"}`);
      } else if (input[i] === 117) {
      output.push(`${"u"}`);
      } else {
      output.push(input[i]);
      }
    }

    return output;
}