JavaScript prototype chain and the scope chain

layout: 'Page' 
title: 'prototype chain and scope chain' 
DATE: 2019-09-30 15:38:38 
Tags: JAVASCRIPT 
the Categories: JAVASCRIPT

 

 

prototype

  • All functions comes a property: prototype, the property value is an object, for instance storing a public method invocation

  • This object comes attribute constructor, the attribute value is itself a function of

  • Each object comes with _ _ proto _ _ of property that points to the current instance prototype of their class (not sure if he is an example of an instance of whom are of Object)

Prototype chain

If the current object does not have this property, it will be the _ _ proto _ _ to find the prototype of their class on this attribute points, and if no, looks to the proto on a prototype of their class ... on Object has been found so far .

The scope chain

  • If this is not currently a private variable scope, will look to their superiors scope, has been found so far window, if there is no window, put the variable added to the window properties.

  • About the only parent scope of a function and where he created

Guess you like

Origin www.cnblogs.com/wangshouren/p/11615810.html