Javascript String isVowel()

Description

Javascript String isVowel()

String.prototype.isVowel = function () {
    var vowels = ['a', 'e', 'i', 'o', 'u'];
    return vowels.indexOf(this.toLowerCase()) != -1;
};

Javascript String isVowel()

'use strict';//from w  w  w.ja  va 2s .co m
String.prototype.isVowel = function() {
  return /[aeiou]/i.test(this);
};



PreviousNext

Related