Tell us what’s happening:
I need help with this: function findLongestWordLength(str) {
return str.length;
}
findLongestWordLength(“The quick brown fox jumped over the lazy dog”);
Your code so far
function truncateString(str, num) {
// Clear out that junk in your trunk
if (str.length > num) {
return str.slice(0, num) + "...";
} else {
return str;
}
}
truncateString("The quick brown fox jumped over the lazy dog");
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/80.0.3987.87 Chrome/80.0.3987.87 Safari/537.36
.
Challenge: Find the Longest Word in a String
Link to the challenge: