Skip to content

Commit d5bcef2

Browse files
committed
spacey
1 parent 0c6ca1b commit d5bcef2

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

7_kyu/spacey.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## [Running out of space](https://www.codewars.com/kata/56576f82ab83ee8268000059/javascript)
2+
3+
##### Story
4+
5+
- Kevin is noticing his space run out! Write a function that removes the spaces from the values and returns an array showing the space decreasing.
6+
- For example, running this function on the array `['i', 'have','no','space']` would produce `['i','ihave','ihaveno','ihavenospace']`
7+
8+
#### Solution:
9+
10+
```js
11+
function spacey(array) {
12+
let joined = "";
13+
return array.map((s) => (joined += s));
14+
}
15+
16+
console.log(spacey(["kevin", "has", "no", "space"])); // [ 'kevin', 'kevinhas', 'kevinhasno', 'kevinhasnospace']
17+
console.log(spacey(["this", "cheese", "has", "no", "holes"])); // ['this','thischeese','thischeesehas','thischeesehasno','thischeesehasnoholes']
18+
```

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ Solutions to CodeWars programming tasks. I try to update every day
401401
</tr>
402402
<tr>
403403
<td><a href=" " > </a></td>
404-
<td><a href="7 kyu" > </a></td>
404+
<td><a href="https://github.com/esadakman/javaScript-coding-challenges/blob/master/7_kyu/spacey.md" >spacey</a></td>
405405
<td><a href="https://github.com/esadakman/javaScript-coding-challenges/blob/master/6_kyu/decipherThis.md" >decipherThis</a></td>
406406
<td><a href="5 kyu" > </a></td>
407407
<td><a href="others " ></a></td>

0 commit comments

Comments
 (0)