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
How to set checkbox and radio option checked on load with jQuery?
Check if a string ends with the given target string
How to declare and print value of variable in JavaScript?
JavaScript example to change image on click
jQuery get the coordinates of div clicked
Using jQuery delete table row on click
jQuery check if an element is visible or hidden
How to scroll page to particular Div on click using jQuery?
jQuery simple form validations between start date and end date
Get largest number from each sub-arrays