mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
be consistent with PascalCasing of constructors
This commit is contained in:
parent
42a2263ab1
commit
a91b4fd300
@ -357,13 +357,13 @@ myObj.meaningOfLife; // = 43
|
|||||||
// Constructors have a property called prototype. This is *not* the prototype of
|
// Constructors have a property called prototype. This is *not* the prototype of
|
||||||
// the constructor function itself; instead, it's the prototype that new objects
|
// the constructor function itself; instead, it's the prototype that new objects
|
||||||
// are given when they're created with that constructor and the new keyword.
|
// are given when they're created with that constructor and the new keyword.
|
||||||
myConstructor.prototype = {
|
MyConstructor.prototype = {
|
||||||
myNumber: 5,
|
myNumber: 5,
|
||||||
getMyNumber: function(){
|
getMyNumber: function(){
|
||||||
return this.myNumber;
|
return this.myNumber;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var myNewObj2 = new myConstructor();
|
var myNewObj2 = new MyConstructor();
|
||||||
myNewObj2.getMyNumber(); // = 5
|
myNewObj2.getMyNumber(); // = 5
|
||||||
myNewObj2.myNumber = 6
|
myNewObj2.myNumber = 6
|
||||||
myNewObj2.getMyNumber(); // = 6
|
myNewObj2.getMyNumber(); // = 6
|
||||||
|
Loading…
Reference in New Issue
Block a user