Tell us what’s happening:
Please my code isn’t passing the 3 and 4 test but if I use the console to check, I get the desired result it’s requesting… But for some reason which I don’t know, I’m unable to pass the test.
Your code so far
function truncateString(string, num){
if(string.length !== num.length){
const truncated = string.slice(0,num)+"..."
return `${truncated}`
}
}
const string = "A-tisket a-tasket A green and yellow basket"
const string2 = "Absolutely longer"
console.log(truncateString(string2, 2))
console.log(truncateString(string, "A-tisket a-tasket A green and yellow basket".length))
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Mobile Safari/537.36
Challenge Information:
Implement the Truncate String Algorithm - Implement the Truncate a String Algorithm