// Find the largest word in a string using Javascript
const largestWordString = (str) => {
let strArray = str.replace(/[.,\/#!$%\^&*;:{}=-_`~()]/g,"").split(" ");
let largestLength = 0;
let largestWord = '';
for ( let i= 0; i < strArray.length; i++) {
if (strArray[i].length > largestLength) {
largestLength = strArray[i].length;
largestWord = strArray[i];
}
}
return largestWord;
}
console.log(largestWordString("This is a great coding challenge to practice"));
//challenge
console.log(largestWordString("fun&!! time"));
//time