-
-
Save ryardley/f52f9dceded74d14e102 to your computer and use it in GitHub Desktop.
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 secret = 'Not telling!'; | |
function Person(name){ | |
this.name = name; | |
this.greeting = 'Hello!'; | |
} | |
Person.prototype.sayGreeting = function(){ | |
return this.name + ' says, "' + this.greeting + '"'; | |
}; | |
Person.prototype.getSecret = function(){ | |
return secret; | |
}; | |
var jane = new Person('Jane'); | |
jane.sayGreeting(); // Jane says, "Hello!" | |
jane.getSecret(); // Not telling! | |
expect(jane instanceof Person).toBe(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment