Prototype chain, call and apply

_private naming rules, try not to modify!
There prototype prototype!
Here Insert Picture Description
Here Insert Picture DescriptionHere Insert Picture DescriptionHere Insert Picture DescriptionSince the prototype is an object, so write the prototype property value when writing an object! Here Insert Picture Description
Here Insert Picture DescriptionThe first 100 is the value of the operation is successful just returned! The default return undefined
only modify the properties themselves!
shui calling this method, this would point to who
Here Insert Picture Descriptiondo not have a second written! Not with a little egg, obj constructor or Object
Object.create (prototype)
the vast majority of objects are traced back to object.prototype
exception is Object.create (null) !!!
123 "123" has a wrapper class object there prototype, you can call toString
Here Insert Picture Description
figures can not be directly written. the priority is the decimal
numbers to call are Number.prototype body to rewrite the toString ()
Here Insert Picture Descriptionsince the prototype is empty, Object.prototype toString method can not be traced to call! Man can write!
Here Insert Picture DescriptiontoFixed (2) two significant figures! 0.4 * 2 have BUG
Math.cail 0.1 are rounded up into!
Math.floor excised down 0.9 will be rounded down!
Math.random randomly generated number between 0-1
Here Insert Picture Description

call and apply change this point, the difference is passed different parameter list!

Here Insert Picture DescriptionHere this refers to the student!
Here Insert Picture Description

Published 37 original articles · won praise 0 · Views 703

Guess you like

Origin blog.csdn.net/weixin_43704007/article/details/104982501