Answers for "js count number of char in string"

2

js character certain count

var str = "Hello Lewes";
var ch = 'e';
 
var count = str.split("e").length - 1;
console.log(count);
 
/*
    Output: 3
*/
Posted by: Guest on October-09-2020
1

count value a to b character javascript

function count (string) {  
  var count = {};
  string.split('').forEach(function(s) {
     count[s] ? count[s]++ : count[s] = 1;
  });
  return count;
}
Posted by: Guest on June-20-2020
6

javascript count character in string

var str = "Hello World!";
var n = str.length;
Posted by: Guest on September-23-2020

Code answers related to "js count number of char in string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language