Answers for "count letter in a string js"

1

how to count specific letters in string js

console.log(("str1,str2,str3,str4".match(/,/g) || []).length); //logs 3

console.log(("str1,str2,str3,str4".match(new RegExp("str", "g")) || []).length); //logs 4
Posted by: Guest on September-08-2020
1

how get count of letters in javascript

//when use length for string this will be return the count of charactor 
//in string
$("#about_me_textarea").val().length
Posted by: Guest on February-03-2021

Code answers related to "count letter in a string js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language