Javascript String vowel()
/*/*from www . j a va 2 s .c o m*/ Implement String#vowel? (in Java StringUtils.isVowel(String)), which should return true if given object is a vowel, false otherwise. */ String.prototype.vowel = function() { return /^[aeiou]$/i.test(this); };
// Is it a vowel? String.prototype.vowel = function() { const regex = /^[aeiou]$/i;/*from w ww.jav a2s . c o m*/ console.log(this); return regex.test(this); }; console.log('a'.vowel());
//Implement String#vowel?, which should return true if given object is a vowel, false otherwise. String.prototype.vowel = function() { return /^[aeiou]$/i.test(this); };
// http://www.codewars.com/kata/regexp-basics-is-it-a-vowel String.prototype.vowel = function() { return /^[aeiou]$/i.test(this) && !/\n/.test(this); };
String.prototype.vowel = function() { return /^[aeiou]$/gi.test(this); };