Could this be a better solution to the "Truncate a String" exercise

Hi, today I finished the exercise “Truncate a String” and after I completed it I checked the “get a hint” to see how they did it. The way I did it didn’t was there so I don’t know if my way of doing it is efficient or not.
Here it is:

function truncateString(str, num) {
  // Clear out that junk in your trunk
  return (str.length > num) ? str.slice(0, num) + "..." : str;

truncateString("A-tisket a-tasket A green and yellow basket", 8);

Looks like the exercise and hints are out of sync - earlier three dots were counted towards returned string’s length (if you try to submit code examples in hints the tests fail).