Truncate a string Help

Hi my code doesn’t seem to work. However, when I look at it it seems to be put together. Can some one help me understand why it’s not resolving correctly for this challenge?

Your code so far

function truncateString(str, num) {
  if(str>3){
     dottedNewNum = num - 3;
     dottedString = str.slice(0,dottedNewNum) + "...";
     return dottedString;
} else {
  return str + "...";
}
}

truncateString("A-tisket a-tasket A green and yellow basket", 11);```
**Your browser information:**

Your Browser User Agent is: ```Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0```.

**Link to the challenge:**
https://www.freecodecamp.org/challenges/truncate-a-string