javascript - node cross file access
我想大声告诉你
我想大声告诉你 2017-05-19 10:31:38
0
1
443
//a.js
var x = 1;
function up(){
    x++;
}
module.exports.x = x;
module.exports.up = up;
//b.js
var vA = require('./a');
a.up();
console.log(a.x)

//c.js
var vA = require('./a');
a.up();
console.log(a.x)

How to change the x value in a in b.js and c.js in the above three files and share the value of x

我想大声告诉你
我想大声告诉你

reply all(1)
小葫芦

I know, it’s a matter of writing order

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template