File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 = {
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 ;
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 ;
You can’t perform that action at this time.
0 commit comments