So, trying to solve this algorithm challenge as many ways as possible. I know I can simplify this and just use .slice() but I’m trying to get creative and use as much of what I’ve learned so far as possible, even if it’s not necessarily the best way. Here’s one that ALMOST solves all the test cases, but it fails the fourth check:

truncateString("Atisket atasket A green and yellow basket", "Atisket atasket A green and yellow basket".length + 2)
should return the stringAtisket atasket A green and yellow basket
.
function truncateString(str, num) {
if (str.length === num) {
return str;
} else {
let newStrArray = [ ];
for (var i = 0; i < num; i++) {
newStrArray.push(str[i]);
}
return newStrArray.join("") + “…”;
}
}
What am I missing? I know there are other methods I can use to pass all the challenges, but how would I get this one to work? (or will it not?)
Challenge: Truncate a String
Link to the challenge: