Created
April 30, 2012 23:49
-
-
Save danielevans/2563717 to your computer and use it in GitHub Desktop.
prototype test in therubyracer
This file contains hidden or 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
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