Answers for "length of string only returns 1 javascript"

0

javascript max characters string function

const getMaxLetter = (str) => {
  let max = 0;
  let maxChar = '';
  str.split('').forEach((char) => {
    if (str.split(char).length > max) {
      max = str.split(char).length - 1;
      maxChar = char;
    }
  });
  return `The max letter is : ${maxChar} and the max number of times it is seen is: ${max} times`;
};
Posted by: Guest on July-21-2020

Code answers related to "length of string only returns 1 javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language