Skip to content
Advertisement

How can I cut a string after X characters?

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";
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement