Skip to content

Instantly share code, notes, and snippets.

@horiajurcut
Created May 2, 2013 11:44
Show Gist options
  • Save horiajurcut/5501685 to your computer and use it in GitHub Desktop.
Save horiajurcut/5501685 to your computer and use it in GitHub Desktop.
var Person = function(hobbies) { this.hobbies = hobbies || []; }
Person.prototype.worthy = function() {
for (var i = 0; i < this.hobbies.length; i++)
if (this.hobbies[i] === 'programming') return true;
};
Person.prototype.visit = function() {
this.worthy() && alert('Open Doors @ [e-spres-oh]');
};
(new Person(['coffee', 'music', 'programming'])).visit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment