Find the complexity bug in this duplicate check.
JavaScript
function hasDuplicate(orderIds) {
const seen = [];
for (const orderId of orderIds) {
if (seen.includes(orderId)) {
return true;
}
seen.push(orderId);
}
return false;
}