Spot the bug in order-ID validation

from Regular expressions
Node 24 intermediate 4 min 1 issue to find

Find why this order-ID validator rejects every second valid value.

JavaScript
const ORDER_ID = /^ORD-\d{4}$/g;

function isOrderId(value) {
  return ORDER_ID.test(value);
}

console.log(['ORD-1001', 'ORD-1002', 'ORD-1003'].map(isOrderId));
Open in playground
Report an error