when i run the code " truncateString(“A-tisket a-tasket A green and yellow basket”, 8) should return “A-tisket…”.
truncateString(“Peter Piper picked a peck of pickled peppers”, 11) should return “Peter Piper…”. i do not know what to do .
you need to reduce the string to the max number of characters requested. But there isn’t much you can do to a string, so you can try first splitting it up in an array. Now try yourself thinking on how you can manipulate the array to get the output you need