Comparing word length to each other
<script>
alert(findLongestWordLength("Go was designed with parallel and concurrent processing in mind.")); // 10
function findLongestWordLength(str) {
return str.split(" ")
.reduce((highest, next) => { // comparing word length to each other
return Math.max(highest, next.length);
}, 0);
}
</script>
Most Helpful This Week
jQuery example of scroll to top
How to declare multiple variables in one statement in Javascript?
jQuery check if an element is visible or hidden
Highlight and get the details of table row on click using JavaScript
How to change text color on click using JavaScript?
Write a function that splits an array into groups the length of size and returns them as a two-dimensional array