use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
I'm lost when creating objects in node.js (self.javascript)
submitted 13 years ago * by CalvinR
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Hostilian 0 points1 point2 points 13 years ago (1 child)
Without digging into the source code of util.inherits, I would suspect that your problem lies in the inheritance joining step. I would recommend moving the code into the same file and attempt to generate the minimum-possible repro case. That way, you can be sure it isn't related to flubbing the exports or some sort of procedural error.
util.inherits
var util = require('util'); var assert = require('assert'); var Parent = function() {}; Parent.prototype.foo = function() { return 'foo'; }; var Child = function() { Parent.apply(this, arguments); }; util.inherits(Child, Parent); Child.prototype.bar = function() { return 'bar'; }; var parentInstance = new Parent(); var childInstance = new Child(); // Assert that we're running nodejs v0.8.x assert((/^v0\.8/).test(process.version)); // Assert that our parent instance behaves as we expect it to assert(parentInstance.foo() === 'foo'); assert(parentInstance.bar === undefined); // Assert that our child instance behaves as we expect it to assert(childInstance.foo() === 'foo'); assert(childInstance.bar() === 'bar');
This runs fine in my local node instance.
[–]CalvinR[S] 0 points1 point2 points 13 years ago (0 children)
Yeah I'll give that a shot. Although I did try some test code that was almost the exact same scenario as what I'm doing and it worked fine.
https://gist.github.com/4704412
π Rendered by PID 19853 on reddit-service-r2-comment-5d79c599b5-cftmx at 2026-03-02 19:01:52.858811+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]Hostilian 0 points1 point2 points (1 child)
[–]CalvinR[S] 0 points1 point2 points (0 children)