What is an “internal slot” of an object in JavaScript?

后端 未结 2 1885
无人及你
无人及你 2020-11-30 04:50

I\'ve tried to understand ECMAScript 2015 specification in one point: Internal Slots of Objects. But this section appeared very unclear to me, especially this sentence:

2条回答
  •  青春惊慌失措
    2020-11-30 05:29

    It's simply an artifice used to be able to describe precisely how the objects should behave.

    They are not real members of the objects and even if in some implementation they are you are not allowed to access them with portable code.

    In other words it's a way to write the specification that allows describing behavior with imperative code that is formally more precise that just using a wordy "natural-language" description of what the behavior should be.

提交回复
热议问题