This works if I put an interger in the second slice position, but not if I use the arguement num. Why?
**Your code so far**
function truncateString(str, num) {
let string = "...";
if (str.length < num){
string = str.slice(0, num) + string;
console.log(string);
return string}
else
return str;
}
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; rv:94.0) Gecko/20100101 Firefox/94.0
Challenge: Truncate a String
Link to the challenge: