First of all, yes I know this question has been asked before, but I still cannot figure out how to make it work. I believe the problem is, I am running files individually through node.js on my Mac terminal, sorta like applications.
Here is the deal. I have one file, bitt1.js, that has var mid = 293.03;.
In my other file, otherFile.js, I have an if, else statement, depending on the variable mid (which is in bitt1.js):
if (mid <= 290) {
trade = true;
} else {
trade = false; }
The issue is, in terminal, I run first bitt1.js, then after I run otherFile.js. This makes it so I can't receive the mid variable from bitt1.js and it comes up as undefined.
How can I solve this issue? I've only found things used within html or etc, where the variables are always "available".
I'm new to JS and this whole thing so some of the stuff I said may be incorrect... and I could have also just been being dumb and the answer is obvious, but please help me out... I've thought about creating a JSON file and writing/reading data from it using the two other files, but I feel there's a better way...
Thanks!
JSON.stringifyfirst