DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR JAVASCRIPT
Truncate a string-Javascript
function truncateString(str, num) { return str.length > num ? str.slice(0, num) + "..." : str; }
Source by forum.freecodecamp.org #
PREVIOUS
NEXT
Tagged:
#Truncate
ADD COMMENT
Topic
COMMENT
Name
4+3 =
Submit