Skip to content

Commit

Permalink
Printing Array elements with Comma delimiters
Browse files Browse the repository at this point in the history
  • Loading branch information
PheRum committed May 20, 2024
1 parent 84c42ea commit f15264b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
15 changes: 15 additions & 0 deletions 8_kyu/Printing Array elements with Comma delimiters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Printing Array elements with Comma delimiters

https://www.codewars.com/kata/56e2f59fb2ed128081001328

Input: Array of elements

["h","o","l","a"]

Output: String with comma delimited elements of the array in th same order.

"h,o,l,a"

Note: if this seems too simple for you try the next level

Note2: the input data can be: boolean array, array of objects, array of string arrays, array of number arrays... 😕
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { printArray } from "./index";

describe("Tests", () => {
it("printArray", () => {
expect(printArray([2, 4, 5, 2])).toBe("2,4,5,2");
});
});
3 changes: 3 additions & 0 deletions 8_kyu/Printing Array elements with Comma delimiters/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function printArray(array: number[]): string {
return array.join(",");
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

### Katas solved

`Total`: 50 \
`8_kyu`: 48 \
`Total`: 51 \
`8_kyu`: 49 \
`7_kyu`: 0 \
`6_kyu`: 2 \
`5_kyu`: 0 \
Expand Down

0 comments on commit f15264b

Please sign in to comment.