Operators

Private brand check

Try the free JavaScript compiler

Tests presence of a declared private element from a lexical scope allowed to reference its private name. Throws for non-object right operands.

Formal Syntax & Structure

javascript syntaxjavascript
#name in object

Working Example

Example Snippetjavascript
class C{#n;static has(o){return #n in o;}}console.log(C.has(new C()),C.has({}));
JavaScript Reference