function findLongestWord(str){
// let arr=str.split(" ");
let arr=str.replace(/[,|.|;]/," ").split(" ");
let longLength=0,word;
for(let i=0;i<arr.length;i++){
if(arr[i].length>longLength){
word=arr[i];
longLength=arr[i].length;
}
}
return {
longLength,word
};
}
let str="hello world,my name is tom";
console.log(findLongestWord(str).longLength,findLongestWord(str).word);



