Truncate a string - I solved this but didn't understand the logic of using num instead of num.length

I replaced num.length for num, but still don’t understand why it works in the num variables which have length in it, since they were the 2 conditions which were working. Furthermore, I changed the order of the first if statement, being num in first. Here is my code:

function truncateString(str, num) {
// Clear out that junk in your trunk
if(num>=str.length){
str=str.slice(0);
}
else if(num<=3){
str=str.slice(0,num).concat("…");
}
else{
str=str.slice(0,num-3).concat("…");
}
return str;
}

truncateString(“A-tisket a-tasket A green and yellow basket”, 11);

Yes I see now, I guess so, but it was only needed 2 statemements, the 1st one didn’t do any difference.