-
-
Save xingrz/4608504 to your computer and use it in GitHub Desktop.
A依赖B,C依赖B,C直接修改了B中的属性,A中的B的属性会不会被改变?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var b = require('./b') | |
console.log(b.val) | |
process.nextTick(function () { | |
var c = require('./c') | |
console.log(b.val) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.val = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var b = require('./b') | |
b.val = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ node a.js | |
1 | |
2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment