There is a question that is tricky. Make a function that takes a string argument like 2:00 p.m.
or 5:50 a.m.
You must not use momentjs
or any other third-party library.
We have three static hours to determine the difference between them and this argument.
7:00 a.m.
for breakfast.
12:00 p.m.
for lunch.
7:00 p.m.
for dinner.
The function should return an array with the first and second elements representing hours and minutes, like below:
eat("2:00 a.m.") // [5, 0];
eat("5:50 p.m.") // [1, 10];