Create Objects
- Using function
- Create Objects without duplication code: use functions
- Using constructors
- To indicate a function is a constructor:
- append new keyword in front of the function name when executing it
- Property of function object
- foo.call() = foo()
- Call can bind different objects and can execute functions
__proto__
- Copy of prototype object
- If some property is not in the object itself, it then looks it in the prototype. If it finds it returns the value of that property
- All the new object instances of function point to same prototype object
- prototype.constructor: property that points to function
Comments
Post a Comment