Hello I have this problem that I don't know how to fix. I have this piece of code in JavaScript. There are two console logs that writes variable to console that I later compare if one is bigger than other. Problem is that JavaScript wrongly compare them in if(alarmArray[i].ExtId < offsetTime)
even if alarmArray[i].ExtId = 11:42:35
and offsetTime = 11:42:7
the condition is still meet and IF will return true
. Is this some kind of JavaScript bug?
for (var i = alarmArray.length - 1; i >= 0; i -= 1) {
console.log(alarmArray[i].ExtId); //writes 11:42:37
console.log(offsetTime); //writes 11:42:7
if (alarmArray[i].ExtId < offsetTime) {
console.log(alarmArray[i]);
alarmArray.splice(i, 1);
}
}