Web APIs

Headers.has()

Try the free JavaScript compiler

Check for a header name without interpreting its value. Header names are case-insensitive. Example console output: true false.

Formal Syntax & Structure

javascript syntaxjavascript
headers.has(name)

Parameters & Attributes

NameTypeDescription
namestringHeader name.

Return Value

boolean

Whether the header exists.

Working Example

Example Snippetjavascript
const h=new Headers({"X-Mode":""}); console.log(h.has("x-mode"),h.has("x-other"));
JavaScript Reference