is my code right?there are two challenges i cannot clear
Your code so far
function truncateString(str, num) {
// Clear out that junk in your trunk
var spl = str.split('');
var newarr = [];
for (let i = 0;i < num;i++)
{
newarr.push(spl[i]);
}
var newstr =newarr.join('') + '...'
return newstr;
}
truncateString("A-tisket a-tasket A green and yellow basket", 8);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string