Tell us what’s happening:
Doesn’t return the correct value
Your code so far
function truncateString(str, num) {
// Clear out that junk in your trunk
if (str.length <= num) {
return str;
} else {
return str.slice(num + 1) + '...';
}
}
truncateString("A-tisket a-tasket A green and yellow basket", 8);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36.