Wednesday 21 November 2018

Hopefully simple question with a hopefully simple answer?

Let me know if this isn't where to post this sorta question!​I've been stuck for a couple hours, and this is kinda Node, kinda just JS related but...​I have 2 classes (class A, and class B) created in my app.js file, what Ideally I want is to have them be able to reference each-other, example:var a = new A();var b = new B();a.relation = b;b.relation = a;Something like this is giving me a Circular reference (as expected) but it's causing node to die because of a RangError.If this is not possible, my second question would be: can I have a variable declared and updated in app.js accessible in different classes? if so, how would I go about this?​Hope I've described what I'm trying to do well enough!​

Submitted November 22, 2018 at 03:29AM by lommaz

No comments:

Post a Comment