Created
February 9, 2010 05:00
-
-
Save tmpvar/298927 to your computer and use it in GitHub Desktop.
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
// base.js | |
var base = function() { | |
}; | |
base.prototype = { | |
}; | |
exports.base = base; | |
// test.js | |
var base = require("./base").base, | |
sys = require("sys"); | |
sys.puts(base.prototype); | |
base.prototype.test = function() { | |
return "yes." | |
}; | |
var t = new base(); | |
sys.puts(t.test()); | |
/* | |
tmpvar@tmpvar:/tmp$ node test.js | |
undefined | |
TypeError: Cannot set property 'test' of undefined | |
at Object.<anonymous> (/tmp/test.js:6:21) | |
at [object Object].<anonymous> (node.js:938:23) | |
at [object Object].emitSuccess (node.js:241:15) | |
at [object Object].<anonymous> (node.js:655:21) | |
at [object Object].emitSuccess (node.js:241:15) | |
at node.js:511:29 | |
at node.js:995:9 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment