files/en-us/web/api/highlightregistry/has/index.md
{{APIRef("CSS Custom Highlight API")}}
The has() method of the {{domxref("HighlightRegistry")}} interface returns a boolean indicating whether or not a {{domxref("Highlight")}} object with the specified name exists in the registry.
HighlightRegistry is a {{jsxref("Map")}}-like object, so this is similar to using {{jsxref("Map.has()")}}.
has(name)
name
Highlight object to test for presence in the registry.Returns true if a highlight with the specified name exists in the registry; otherwise false.
const fooHighlight = new Highlight();
CSS.highlights.set("foo", fooHighlight);
myHighlight.has("foo"); // true
myHighlight.has("bar"); // false
{{Specifications}}
{{Compat}}