Truncate a String 2019

Tell us what’s happening:

I don’t even understand this one bit. Can someone walk through this problem step by step. I don’t know where the number 3 is coming from, I don’t see it anywhere in the problem’s question. The entire problem start to finish makes no logical sense to me. I tried to look at the solution for an hour. Please walk me through this.

Your code so far

function truncateString(str, num) {
  // Clear out that junk in your trunk
  str = truncateString(str, num); 
if(str.Length > num > 3) { 
  return str.slice(0, (num-3)) + '...';
  else if str.length > num && num <= 3 {
    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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36.

Link to the challenge:

The code I put in is not my code, its just what I wrote from the solution. In reality, I am completely stuck from the start.

Maybe you don’t understand this code because it has syntax errors.

I would search medium articles or youtube videos for detailed explanations. Here is one.

My post got deleted,. but the solution provided above is wrong.


Your post got deleted because you gave out a solution, which doesn’t help explain. Yes, I mentioned that the op’s solutions is wrong and directed him to an article that will explain about the challenge.