truncate a stringa FreeCodeCamp challenge
function truncateString(str, num) {
  if (str.length <= num) {
    console.log(str);
    overlay(str);
    return str;
  } else if (num <= 3) {
    overlay(str.slice(0 , num ) + '...');
    console.log(str.slice(0 , num ) + '...');
    return str.slice(0 , num ) + '...';
  } else {
    overlay(str.slice(0 , num - 3) + '...');
    console.log(str.slice(0 , num - 3) + '...');
    return str.slice(0 , num - 3) + '...';
  }

}