how to shorten string in js code example Example: short string javascript short = long.replace(/(.{7})..+/, "$1…");