Last active
August 29, 2015 14:07
-
-
Save justinbmeyer/b8f12de0e31f7ff2ff8b to your computer and use it in GitHub Desktop.
DOT code
This file contains 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 Person = function(name) { | |
this.name = name; | |
} | |
Person.prototype.isPerson = true; | |
var person = new Person('Smith'); | |
DOT(person, 'name'); //person.name | |
DOT(person, 'isPerson'); //person.isPerson |
This file contains 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 Person = function(name) { | |
this.name = name; | |
} | |
Person.prototype.speak = function(){ | |
console.log('Hello! ' + this.name); | |
} | |
var person = new Person('Smith'); | |
// DOTCALL( obj, propertyName, args ); | |
DOTCALL( person, 'speak' , [] ); //person.speak() |
This file contains 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 Person = function(name) { | |
this.name = name; | |
} | |
person = new Person( 'Alexis' ); | |
INSTANCEOF( person, Person ); |
This file contains 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 Person = function(name) { | |
this.name = name; | |
} | |
Person.prototype.speak = function(){ console.log(‘Hello!’) } | |
var person = NEW( Person, ['name'] ); | |
// var person = new Person(‘name’) | |
person.speak(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment