Skip to content

Commit da09dbd

Browse files
committed
shouldn't this pattern be consistent with the
general function-declaration patterns?
1 parent f4561c1 commit da09dbd

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

code-reuse-patterns/prototypal-inheritance.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
Description: objects inherit from other objects
1111
*/
1212

13-
function object(o) {
14-
function F() {
15-
}
13+
var object = function object(o) {
14+
var F = function F() {
15+
};
1616

1717
F.prototype = o;
1818
return new F();
19-
}
19+
};
2020

2121
// object to inherit from
2222
var parent = {
@@ -31,10 +31,10 @@
3131

3232

3333
// parent constructor
34-
function Person() {
34+
var Person = function Person() {
3535
// an "own" property
3636
this.name = "Adam";
37-
}
37+
};
3838
// a property added to the prototype
3939
Person.prototype.getName = function () {
4040
return this.name;
@@ -49,10 +49,10 @@
4949

5050

5151
// parent constructor
52-
function Person() {
52+
var Person = function Person() {
5353
// an "own" property
5454
this.name = "Adam";
55-
}
55+
};
5656
// a property added to the prototype
5757
Person.prototype.getName = function () {
5858
return this.name;

0 commit comments

Comments
 (0)