How can I cut a string after a specific number of characters in JavaScript?
I then want to append the ‘…’ Unicode character. How can I do this?
Advertisement
Answer
Simply
var trunc = "abcdef".substr(0, 3) + "u2026";
How can I cut a string after a specific number of characters in JavaScript?
I then want to append the ‘…’ Unicode character. How can I do this?
Simply
var trunc = "abcdef".substr(0, 3) + "u2026";