longest word with reduce method in javascript code example
Example: js find longest word in string function
function findLongestWordLength(str) {
return Math.max(...str.split(' ').map(word => word.length));
}
function findLongestWordLength(str) {
return Math.max(...str.split(' ').map(word => word.length));
}