Longest Word in a String

Hi all any advice on how i can make below work?

function findLongestWord(str) {
	var newArray = str.split(" ");
	var lengthArrayObjects = [];
	var arrayLength = length.newArray;
	for(i=0; i<arrayLength; i++) {
        lengthArrayObjects += lengthArrayObjects.push(newArray[i]);
		}
  {
	lengthArrayObjects.sort((function(a, b){return b-a}));
	
  }

	return lengthArrayObjects[0];
}


findLongestWord("The quick brown fox jumped over the lazy dog");


First fix the syntax errors (at least two).

Then rename all your variables, as you’re confusing both yourself and us readers.

Then read it slowly again and imagine running each line separately.

Thank you. I’ve gone back and cleaned a bit of my code .

I’m thinking this is creating an item in the array for each iteration of i.