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 example to change image on click
jQuery simple form validations between start date and end date
How to define Global Variable in JavaScript?
jQuery Show or Hide text on button click
jQuery simple form with name and email validations
Example to take user input and display on screen using JavaScript