Tell us what’s happening:
I am getting desired output from this code. but not understanding what is missing here. please help
Your code so far
const truncateString= (stringArg, numArg) => {
const stringArglength = stringArg.length;
if(stringArglength > numArg){
const truncatedString = stringArg.slice(0,numArg);
return `${truncatedString}... `
}
}
console.log(truncateString("A-", 1))
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
Challenge Information:
Implement the Truncate String Algorithm - Implement the Truncate a String Algorithm