Here is the requirement details:
time = ["09-13", "12-14"]
getResult(time) = false
The first performance runs from 9 a.m. to 1 p.m. and the second one starts at 12 p.m. So you won't be able to see each performance in full.
time = ["07-09", "10-12", "15-19"]
getResult(time) = true
but i could not able to get the result. I am finding challange to get it done. any one help me?
here is my try:
const getResult = (time) => {
const nums = [];
let pre = 0;
time.map((item,index) => {
item.split('-').map((v,i) => {
nums.push(+v);//converting as number
});
});
const result = nums.map((v,i) => {
if(!i) return;
console.log(v-pre)//but logically this is not works
pre = v;
})
}
//time = ["09-13", "12-14"]; //false
time = ["07-09", "10-12", "15-19"] //true
getResult(time); //should be false
Thanks in advance.