js find the longest string in an array code example
Example 1: js find longest word in string function
function findLongestWordLength(str) {
return Math.max(...str.split(' ').map(word => word.length));
}
Example 2: javascript find the longest string in array
Math.max(...(x.map(el => el.length)));