truncateString
Truncates a string up to a specified length.
- Determine if
String.prototype.lengthis greater thannum. - Return the string truncated to the desired length, with
'...'appended to the end or the original string.
Truncates a string up to a specified length.
String.prototype.length is greater than num.'...' appended to the end or the original string.