Javascript String character()

Description

Javascript String character()


var string = "Those this have vowels";
var vowel = ["a", "e", "i", "o", "u"];

String.prototype.character = function name() {
    var i;//from  w w  w . j av  a  2s.  com
    for ( i = 0; i < vowel.length; i++) {
        var secondLoop = string.length;
        for ( j = 0; j < secondLoop; j++) {
            if (vowel[i] == string.charAt(j)) {
                string = string.slice(0, j).concat(string.slice(j + 1, secondLoop));
                j--;
                secondLoop--;
            }

        }
    }
}

string.character();
console.log(string);



PreviousNext

Related