Answers for "str limit in js"

5

js string limit length

string.substring(0,lengthRequired+1);
Posted by: Guest on February-11-2021
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 "Javascript"

Browse Popular Code Answers by Language