Not sure whats happening here. Had a friend even take a look at it and still can’t figure out whats going. I clicked the “get a hint” and still had the same issue. So just for kicks i plugged in one of the solutions, and the same problem persisted: the top two challenges failed.
My code so far
function truncateString(str, num) {
if(str.length > num && (num > 3)) {
return str.slice(0, (num - 3)) + '...';
} else if(str.length > num && num <= 3) {
return str.slice(0, num) + "...";
} else {
return str;
}
}
truncateString("A-tisket a-tasket A green and yellow basket", 8);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string/