⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’
Excalidraw Data
Text Elements
Player Initial Object
Player2
Player1
Player.prototype
Object.prototype
proto
proto
_proto
proto
Null
There is a Player function and two players object created from it as follows
function Player(name, marker) { this.name = name; this.marker = marker; this.sayName = function() { console.log(this.name) }; }
const player1 = new Player(‘Prakhar’, ‘X’); const player2 = new Player(‘John’, ‘O’);
prototype : The prototype is an object that lies on the parent constructor from which child constructors are derived from.
proto or Prototype or Object.getPrototypeOf(specific_dervied_object)
proto is the property that points to the prototype object of the parent.
Thus the chain can be described as follows (in reversed order)
-
Object.getPrototypeOf(Player1)Player.prototype and Object.getPrototypeOf(Player2) Player.prototype Returns true for both as for both players the proto property property is inherited from the Player’s prototype object.
-
Object.getPrototypeOf(Player.prototype)==Object.prototype returns true because Player.prototype is inherited from Object.prototype
-
Object.getPrototypeOf(Object.prototype)==NULL as their is no higher up prototype than Object.
Difference b/w prototype and proto
Definitions
Note: Note: For our easeness proto ~ Prototype ~ Object.getPrototypeOf(specific_dervied_object)
Element Links
CMujaeKe: Prototype