FCC - Find the longest word in a string

FCC challenge

by Tom M

HTML

<div id="hello">

</div>

JavaScript

function findLongestWordLength(str) {
	var newArray = str.split(" ");
	var sortArray = newArray.sort (function(a,b){return b.length-a.length});
	return sortArray[0].length;
}


document.getElementById("hello").innerHTML = findLongestWordLength("The quick brown fox jumped over the lazy dogggggggggggghhyjjkjk");