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 Call 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 GitHub repo: https://github.com/kaosadi17/JavaScript/blob/master/objects%26prototypes.js
Comments
Post a Comment