update snippets 96-107

This commit is contained in:
Stefan Feješ
2017-12-25 14:38:49 +01:00
committed by Agamemnon Zorbas
parent a7fe8cb9d6
commit 6bedb8fba4
11 changed files with 70 additions and 40 deletions

View File

@ -5,9 +5,12 @@ Repeats a string n times using `String.repeat()`
If no string is provided the default is `""` and the default number of times is 2.
```js
const repeatString = (str = '', num = 2) => {
return num >= 0 ? str.repeat(num) : str;
};
// repeatString("abc",3) -> 'abcabcabc'
// repeatString("abc") -> 'abcabc'
const repeatString = (str="",num=2) => {
return num >= 0 ? str.repeat(num) : str;
}
```
```js
repeatString("abc",3) // 'abcabcabc'
repeatString("abc") // 'abcabc'
```