From e370ef34bcce4e6599cb78a83932ad93a9e1b0aa Mon Sep 17 00:00:00 2001 From: zainabdnaya Date: Fri, 13 Oct 2023 06:00:04 -0400 Subject: [PATCH] docs(splitStringIntoString): Adding the subject of exercice spliStringIntoPairs for js piscine --- subjects/splitStringIntoPairs/README.md | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 subjects/splitStringIntoPairs/README.md diff --git a/subjects/splitStringIntoPairs/README.md b/subjects/splitStringIntoPairs/README.md new file mode 100644 index 000000000..dfc50988c --- /dev/null +++ b/subjects/splitStringIntoPairs/README.md @@ -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'] + +```