Skip to content

Instantly share code, notes, and snippets.

@danielevans
Created April 30, 2012 23:49
Show Gist options
  • Save danielevans/2563717 to your computer and use it in GitHub Desktop.
Save danielevans/2563717 to your computer and use it in GitHub Desktop.
prototype test in therubyracer
therubyracer> Person.prototype.test = function() { return "hello world"; }
function () { return "hello world"; }
therubyracer> var Hippo;
therubyracer> Hippo = Person.prototype.constructor;
function () {}
therubyracer> var mystery = new Hippo();
therubyracer> mystery.test();
hello world
therubyracer> mystery instanceof Hippo
true
therubyracer> mystery instanceof Person
true
therubyracer> mystery instanceof Object
true
therubyracer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment