Proxy ` constructor. It
contains the traps which define the behavior of the proxy.

trap

    

The function that define the behavior for the corresponding  object internal
method  . (This is analogous to the concept of _traps_ in operating systems.)

target

    

Object which the proxy virtualizes. It is often used as storage backend for
the proxy. Invariants (semantics that remain unchanged) regarding object non-
extensibility or non-configurable properties are verified against the target.

invariants

    

Semantics that remain unchanged when implementing custom operations. If your
trap implementation violates the invariants of a handler, a [ ` TypeError `
](/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) will be
thrown.

###  Object internal methods

[ Objects ](/en-US/docs/Web/JavaScript/Data_structures#objects) are
collections of properties. However, the language doesn't provide any machinery
to _directly_ manipulate data stored in the object â rather, the object
defines some internal methods specifying how it can be interacted with. For
example, when you read ` obj.x ` , you may expect the following to happen:

  * The ` x ` property is searched up the [ prototype chain ](/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain) until it is found. 
  * If ` x ` is a data property, the property descriptor's ` value ` attribute is returned. 
  * If ` x ` is an accessor property, the getter is invoked, and the return value of the getter is returned. 

There isn't anything special about this process in the language â it's just
because ordinary objects, by default, have a ` [[Get]] ` internal method that
is defined with this behavior. The ` obj.x ` property access syntax simply
invokes the ` [[Get]] ` method on the object, and the object uses its own
internal method implementation to determine what to return.

As another example, [ arrays ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Array) differ from normal
objects, because they have a magic [ ` length ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Array/length) property that,
when modified, automatically allocates empty slots or removes elements from
the array. Similarly, adding array elements automatically changes the ` length
` property. This is because arrays have a ` [[DefineOwnProperty]] ` internal
method that knows to update ` length ` when an integer index is written to, or
update the array contents when ` length ` is written to. Such objects whose
internal methods have different implementations from ordinary objects are
called _exotic objects_ . ` Proxy ` enable developers to define their own
exotic objects with full capacity.

All objects have the following internal methods:

Internal method  |  Corresponding trap   
---|---  
` [[GetPrototypeOf]] ` |  [ ` getPrototypeOf() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getPrototypeOf)  
` [[SetPrototypeOf]] ` |  [ ` setPrototypeOf() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/setPrototypeOf)  
` [[IsExtensible]] ` |  [ ` isExtensible() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/isExtensible)  
` [[PreventExtensions]] ` |  [ ` preventExtensions() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/preventExtensions)  
` [[GetOwnProperty]] ` |  [ ` getOwnPropertyDescriptor() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor)  
` [[DefineOwnProperty]] ` |  [ ` defineProperty() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/defineProperty)  
` [[HasProperty]] ` |  [ ` has() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/has)  
` [[Get]] ` |  [ ` get() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/get)  
` [[Set]] ` |  [ ` set() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/set)  
` [[Delete]] ` |  [ ` deleteProperty() ` ](/en-US/docs/Web/JavaScript/Reference/Gl