Last active
April 11, 2016 14:33
-
-
Save LinZap/4c906c25b7ddd76300764ee6c2c1ac20 to your computer and use it in GitHub Desktop.
Node.js static data - 猜猜看 index.js 最後印出什麼?
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 d = require('./data'); | |
module.exports = { | |
add: function(item){ | |
d.data.push(item); | |
} | |
} |
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 Data = function(){} | |
Data.data = []; | |
module.exports = Data; |
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 c = require('./control'); | |
c.add("AAA"); | |
var data = require('./data').data; | |
/* | |
這個印出什麼? | |
*/ | |
console.log(data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
猜猜看
index.js
最後印出什麼?