Write a function middleThree(text) that returns the three characters in the middle of the string text: 'NewMumbai' gives 'Mum'.
text is plain Latin text from 0 to 1000 characters. Every character counts, spaces and signs too, also at the start and the end. Do not trim the text.text is 3 or less, return text as it is. For an empty string return ''.''.You can cut the part out with slice.
middleThree('NewMumbai')Returns 'Mum'
middleThree('abcd')Returns null
middleThree('ab')Returns 'ab'
Asked at EPAM · Source
middleThree('NewMumbai')'Mum'middleThree('abcd')nullmiddleThree('ab')'ab'Hidden tests run on Submit.