update snippets 0-All
This commit is contained in:
committed by
Agamemnon Zorbas
parent
6bedb8fba4
commit
0c129cdd02
@ -8,5 +8,8 @@ Return the string truncated to the desired length, with `...` appended to the en
|
||||
```js
|
||||
const truncateString = (str, num) =>
|
||||
str.length > num ? str.slice(0, num > 3 ? num - 3 : num) + '...' : str;
|
||||
// truncateString('boomerang', 7) -> 'boom...'
|
||||
```
|
||||
|
||||
```js
|
||||
truncateString('boomerang', 7) -> 'boom...'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user