6 lines
143 B
JavaScript
6 lines
143 B
JavaScript
export const shrinkText = (str, n) => {
|
|
let newStr = str.substring(0, n);
|
|
if (str.length > n) newStr = newStr + "...";
|
|
return newStr;
|
|
};
|