HELP! Truncate a String

HELP! Truncate a String
0

#1

Hello guys,

I’m stuck. :persevere:

Can you hint what am I doing wrong?

function truncateString(str, num) {

var lengthStr = str.length;
var numStr = num.length; 
var final= str.slice(str, num)

if (lengthStr>3){
  return final + '...'}
 
else if (str<3){
    return final;
} else {
  return ''
}

}  
console.log(truncateString("A-tisket a-tasket A green and yellow basket", "A-tisket a-tasket A green and yellow basket".length + 2));

#2

else if (str<3){
You’re checking whether the string str is less than 3.