Truncate a string Help

Truncate a string Help
0.0 0

#1

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

#2

str is a string. 3 is a number. Your if statement is comparing a String to a Number. This will always evaluate to false, so your else code block will execute.

You should probably review the previous FCC challenge, to help you figure out what you should be comparing to 3.