How to make string shorter javascript
const string = "Name".slice(0, 250).concat('...');
const string2 = "Name".substring(0, 250).concat('...');
How to make string shorter javascript
const string = "Name".slice(0, 250).concat('...');
const string2 = "Name".substring(0, 250).concat('...');
javascript cut string if too long
if (string.length > 25) {
string = string.substring(0, 24) + "...";
}
//or
function truncate(str, n){
return (str.length > n) ? str.substr(0, n-1) + '…' : str;
};
//or with CSS
p {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
//or with replace
short = long.replace(/(.{7})..+/, "$1…");
shorten string js
let str = "Hello world!";
str.slice(0, 5) // Returns "Hello"
short string javascript
short = long.replace(/(.{7})..+/, "$1…");
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us