Web APIs

Headers.get()

Try the free JavaScript compiler

Read a header by case-insensitive name. Missing headers return null; multiple ordinary values may be combined. Example console output: 3 true.

Formal Syntax & Structure

javascript syntaxjavascript
headers.get(name)

Parameters & Attributes

NameTypeDescription
namestringHeader name.

Return Value

string or null

Combined header value or null.

Working Example

Example Snippetjavascript
const h=new Headers({"X-Count":" 3 "}); console.log(h.get("x-count"),h.get("missing")===null);
JavaScript Reference