1String.prototype.trimEllip = function (length) {
2 return this.length > length ? this.substring(0, length) + "..." : this;
3}
1const getMaxLetter = (str) => {
2 let max = 0;
3 let maxChar = '';
4 str.split('').forEach((char) => {
5 if (str.split(char).length > max) {
6 max = str.split(char).length - 1;
7 maxChar = char;
8 }
9 });
10 return `The max letter is : ${maxChar} and the max number of times it is seen is: ${max} times`;
11};