// OBJECT PROGRAMMING
avi = {
walk: function() { console.log(this.name + ' is walking') },
name: 'Avi'
}
avi.walk()
avi.lastName = 'Kaufman'
// PROTOTYPE PROGRAMMING
anotherAvi = {}
anotherAvi.__proto__ = avi
console.log(anotherAvi.name)
// CLASS BASED
function Person(name) {
this.name = name
}
Person.prototype.walk = function() { console.log(this.name + ' is walking') }
console.log(new Person('bill'))
// confused? http://dmitry.baranovskiy.com/post/objects-in-javascript-part-ii
-
Notifications
You must be signed in to change notification settings - Fork 0
firefoxes/js-objects-prototypes-classes
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published