If there are two or more words that are the same length, return the first word from the string with that length. I am a beginner. Could anyone highlight good and bad parts of the following program.Also, had it been last word from the string with that length, would it give different result in Chrome and Firefox because of it being unstable in Chrome ?function LongestWord(sen) { var arr2=[];var arr =sen.split( );var arr1=arr;arr.sort(function (a,b){if(a.length<b.length){    return -1;}else if(a.length===b.length){    return 0;}else return 1;});var len =arr[arr.length-1].length;for(var i =0 ; i<arr1.length;i++)  {     if(arr1[i].length===len)    {    arr2.push(arr[i]);    break;     }    }  return(arr2.pop());}
Finding the largest word in the given String
javascript;strings