Currently trying to figure out how to find the longest word in as string and my research has gotten me somewhere. I found a code on SO that shows the amount of alphabets in
function longest(str) {
var words = str.split(' ');
var longest = ''; // changed
for (var i = 0; i < words.length; i++) {
if (words[i].length > longest.length) { // changed
longest = words[i]; // changed
}
}
return longest;
}
console.log(longest("This is Andela"));