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
JavaScript sort multi dimensional array on specific columns
JavaScript example to change image on click
Generate random password for form field on click using JavaScript
JavaScript HTML5 Validation for name and email field
JavaScript simple alert on Click
How to join string with number in JavaScript?