Answers for "javascript create function where it count letters in a string"

PHP
7

javascript count character in string

var str = "Hello World!";
var n = str.length;
Posted by: Guest on September-23-2020
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
0

count a character in a string, js

"this is foo bar".split("o").length - 1;
// returns 2
Posted by: Guest on December-27-2021

Code answers related to "javascript create function where it count letters in a string"

Browse Popular Code Answers by Language