You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Javascript uses prototypal inheritance model. That means that every constructor function/class has a prototype property that is shared by every instance of the constructor/class. So any properties and methods or prototype can be acessed by every instance. prototype property returns a object
2
+
Property Lookup
3
+
If child does not have ask parent
4
+
Everything in JS is an Object
4
5
*/
5
6
6
7
functionAccount(name,initialBalance){
7
8
this.name=name;
8
9
this.balance=initialBalance;
10
+
this.bank="Bank Of America";
11
+
//This takes precedence over proto, if not present then it will look property and methods in proto
9
12
}
10
13
11
14
Account.prototype.bank="CHASE";
@@ -17,8 +20,11 @@ Account.prototype.deposit = function (amount) {
0 commit comments