Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript count occurrences of letter in string

function count(str, find) {
    return (str.split(find)).length - 1;
}

count("Good", "o"); // 2
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #count #occurrences #letter #string
ADD COMMENT
Topic
Name
1+5 =