This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Animal = clazz(function Animal(){ | |
this.private = { | |
name: 'animal' | |
}; | |
this.public = { | |
sayHello: function sayHello(){ | |
return 'Hi, my name is ' + this.private.name + '!'; | |
} | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Animal = clazz(function Animal(){ | |
this.protected = { | |
name: 'animal' | |
}; | |
this.public = { | |
sayHello: function sayHello(){ | |
return 'Hi, my name is ' + this.protected.name + '!'; | |
} | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Animal = clazz(function Animal(){ | |
this.private = { | |
name: 'animal' | |
}; | |
this.public = { | |
sayHello: function sayHello(){ | |
return 'Hi, my name is ' + this.private.name + '!'; | |
} | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Animal(){} | |
Animal.prototype = { | |
name: 'animal', | |
sayHello: function sayHello(){ | |
return 'Hi, my name is ' + this.name + '!'; | |
} | |
}; | |
function Dog(){} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Animal = clazz(function Animal(){ | |
this.private = { | |
name: 'animal' | |
}; | |
this.public = { | |
sayHello: function sayHello(){ | |
return 'Hi, my name is ' + this.private.name + '!'; | |
} | |
}; | |
}); |
NewerOlder