mirror of https://github.com/01-edu/public.git
docs(splitStringIntoString): Adding the subject of exercice spliStringIntoPairs for js piscine
This commit is contained in:
parent
f2d394ad62
commit
e370ef34bc
|
@ -0,0 +1,31 @@
|
|||
## splitStringIntoPairs
|
||||
|
||||
### Instructions
|
||||
|
||||
Splits the string into pairs of two characters.
|
||||
If the string contains an odd number of characters then it should replace the missing second character of the final pair with an underscore ('_')
|
||||
### Expected function
|
||||
|
||||
|
||||
```js
|
||||
function splitStringIntoPairs(str) {
|
||||
}
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
Here is a possible program to test your function :
|
||||
|
||||
```js
|
||||
console.log(splitStringIntoPairs("abc"));
|
||||
console.log( splitStringIntoPairs("abcdef"));
|
||||
```
|
||||
|
||||
And its output :
|
||||
|
||||
```console
|
||||
$ node index.js
|
||||
$ ['ab', 'c_']
|
||||
$ ['ab', 'cd', 'ef']
|
||||
|
||||
```
|
Loading…
Reference in New Issue