JSFiddle - React, Tailwind, and code Playground

by Jessie Lau

HTML

<!-- function LetterCountI(str) take the str parameter being passed and return the first word with the greatest number of repeated letters. For example: "Today, is the greatest day ever!" should return greatest because it has 2 e's (and 2 t's) and it comes before ever which also has 2 e's. If there are no words with repeating letters return -1. Words will be separated by spaces.  -->

JavaScript

function LetterCountI(str) { 
    var s = str.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"").split("");
         
    return s;
    console.log(s);
}
console.log(LetterCountI("Hello apple pie"));
console.log(LetterCountI("Today, is the greatest day ever"));