X Tutup
Skip to content

Commit 6affd2f

Browse files
committed
update
1 parent 1c38e5c commit 6affd2f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

OO/createObject.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99

1010

1111
//【工厂模式】
12-
// function Person(name, age) {
13-
// var o = new Object();
14-
// o.name = name;
15-
// o.age = age;
16-
// o.sayName = function() {
17-
// console.log(this.name);
18-
// };
19-
// return o;
20-
// }
21-
22-
// var person1 = Person('Nicholas', 29),
23-
// person2 = Person('Greg', 27);
24-
12+
function Person(name, age) {
13+
var o = new Object();
14+
o.name = name;
15+
o.age = age;
16+
o.sayName = function() {
17+
console.log(this.name);
18+
};
19+
return o;
20+
}
21+
22+
var person1 = Person('Nicholas', 29),
23+
person2 = Person('Greg', 27);
24+
2525
//【工厂模式】
2626

2727

0 commit comments

Comments
 (0)
X Tutup