truncate function react
const truncate = (str, n) => {
return str?.length > n ? str.substr(0, n - 1) + "..." : str;
};
Are there any code examples left?
New code examples in category Javascript
const truncate = (str, n) => {
return str?.length > n ? str.substr(0, n - 1) + "..." : str;
};