DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
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
COMMENT
Name
9+1 =
Submit