I have two modules: lets call them a and bmodule A: I have a function that has the following:var data;var storeData=function (el){data=el;}console.log(data);module.exports={storeData};Module B: I import the above from A and call it and pass a param:var test=require("./moduleA")test.storeData("hello");So now, basically when I call this I want the console.log(data) in module A to spit out "hello". What doesn't this work?
Submitted February 14, 2019 at 09:17PM by gqtrees
No comments:
Post a Comment