diff --git a/8_kyu/Take an Arrow to the knee, Functionally/README.md b/8_kyu/Take an Arrow to the knee, Functionally/README.md new file mode 100644 index 0000000..79ce84a --- /dev/null +++ b/8_kyu/Take an Arrow to the knee, Functionally/README.md @@ -0,0 +1,19 @@ +## Take an Arrow to the knee, Functionally + +https://www.codewars.com/kata/559f3123e66a7204f000009f + +**Arrow style Functions** + +Come here to practice the Arrow style functions Not much else to say good luck! + +**Details** + +You will be given an array of numbers which can be used using the String.fromCharCode() (JS), Tools.FromCharCode() (C#) method to convert the number to a character. It is recommended to map over the array of numbers and convert each number to the corresponding ascii character. + +**Examples** + +These are example of how to convert a number to an ascii Character: +Javascript => String.fromCharCode(97) // a +C# => Tools.FromCharCode(97) // a + +**Reference**: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions diff --git a/8_kyu/Take an Arrow to the knee, Functionally/index.test.ts b/8_kyu/Take an Arrow to the knee, Functionally/index.test.ts new file mode 100644 index 0000000..06eb334 --- /dev/null +++ b/8_kyu/Take an Arrow to the knee, Functionally/index.test.ts @@ -0,0 +1,8 @@ +import { arrowFunc } from "./index"; + +describe("Tests", () => { + it("arrowFunc", () => { + expect(arrowFunc([84, 101, 115, 116])).toEqual("Test"); + expect(arrowFunc([70, 85, 83, 32, 82, 79, 72, 32, 68, 65, 72])).toEqual("FUS ROH DAH"); + }); +}); diff --git a/8_kyu/Take an Arrow to the knee, Functionally/index.ts b/8_kyu/Take an Arrow to the knee, Functionally/index.ts new file mode 100644 index 0000000..91cbb21 --- /dev/null +++ b/8_kyu/Take an Arrow to the knee, Functionally/index.ts @@ -0,0 +1,3 @@ +export function arrowFunc(numbers: number[]) { + return numbers.map((item) => String.fromCharCode(item)).join(""); +} diff --git a/README.md b/README.md index 2c6d9d7..247e6e3 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ ### Katas solved -`Total`: 35 \ -`8_kyu`: 34 \ +`Total`: 36 \ +`8_kyu`: 35 \ `7_kyu`: 0 \ `6_kyu`: 1 \ `5_kyu`: 0 \