Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 493 Bytes

(7 kyu) Get the Middle Character.md

File metadata and controls

14 lines (10 loc) · 493 Bytes

(7 kyu) Get the Middle Character

https://www.codewars.com/kata/get-the-middle-character/

You are going to be given a word. Your job is to return the middle character of the word. If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters.

Examples:

Kata.getMiddle("test") should return "es"
Kata.getMiddle("testing") should return "t"
Kata.getMiddle("middle") should return "dd"
Kata.getMiddle("A") should return "A"