Here is an example enum:
enum Status {
inactive = -1,
active = 0,
pending = 1,
processing = 2,
completed = 3,
}
I am trying to compare values using the greater than
operator in a condition. However, the current comparison always results in false.
const statusValue = 2;
order.status = Status[statusValue];
if (order.status > Status.active) {
console.log('Order status:', order.status);
}
What would be the correct way to use the greater than operator in this scenario?