function truncate(str, len){
return str.length <= len ? str: (str.substr(0, len)+"...");
}
truncate("1234567890", 5); // "12345..."
Go to list of users who liked
More than 5 years have passed since last update.
function truncate(str, len){
return str.length <= len ? str: (str.substr(0, len)+"...");
}
truncate("1234567890", 5); // "12345..."
Register as a new user and use Qiita more conveniently
Go to list of users who liked