Sentinel Value
Noun · Development
Definitions
A special in-band value (such as -1, null, or EOF) used to signal an exceptional condition or the end of data within a stream or return type, avoiding the need for a separate error channel — though prone to ambiguity if the sentinel could also be a legitimate value.
In plain English: A magic value like -1 or null that means 'not found' or 'end of data' instead of being an actual result.
Example: "indexOf returns -1 as a sentinel value when the substring isn't found, which is why you see the classic `if (idx !== -1)` check everywhere."