Answers for "most popular letter in str javascript"

0

most popular letter in str javascript

var getMax = function (str) {
 var max = 0,
     maxChar = '';
  str.split('').forEach(function(char){
    if(str.split(char).length > max) {
        max = str.split(char).length;
        maxChar = char;
     }
  });
  return maxChar;
};
Posted by: Guest on July-18-2020

Code answers related to "most popular letter in str javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language