Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 855 Bytes

the-office-iv-finda-a-meeting-room.md

File metadata and controls

26 lines (18 loc) · 855 Bytes

The Office IV - Find a Meeting Room 7 Kyu

LINK TO THE KATA - FUNDAMENTALS ARRAYS

Description

Your job at E-Corp is both boring and difficult. It isn't made any easier by the fact that everyone constantly wants to have a meeting with you, and that the meeting rooms are always taken!

In this kata, you will be given an array. Each value represents a meeting room. Your job? Find the first empty one and return its index (N.B. There may be more than one empty room in some test cases).

'X' --> busy
'O' --> empty

If all rooms are busy, return "None available!"

Solution

const meeting = x => (x.indexOf('O') < 0 ? 'None available!' : x.indexOf('O'))