truncate function react

Solutions on MaxInterview for truncate function react by the best coders in the world

showing results for - "truncate function react"
Giulia
28 Sep 2019
1const truncate = (str, n) => {
2		return str?.length > n ? str.substr(0, n - 1) + "..." : str;
3	};