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
else if(num<=3){
return str;

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

The num variable passed into the function repeat is an integer. Not sure what value num.length was giving you, but it should have been undefined. The length property is meant to work with strings such as str in this challenge.

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