Answers for "wap to find the count of each word starting character in javascript"

2

javascript count words in string

var str = "your long string with many words.";
var wordCount = str.match(/(w+)/g).length;
alert(wordCount); //6

//    w+    between one and unlimited word characters
//    /g     greedy - don't stop after the first match
Posted by: Guest on January-31-2021
9

javascript count occurrences of letter in string

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

count("Good", "o"); // 2
Posted by: Guest on May-31-2021

Code answers related to "wap to find the count of each word starting character in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language