Skip to content

Instantly share code, notes, and snippets.

@LinZap
Last active April 11, 2016 14:33
Show Gist options
  • Save LinZap/4c906c25b7ddd76300764ee6c2c1ac20 to your computer and use it in GitHub Desktop.
Save LinZap/4c906c25b7ddd76300764ee6c2c1ac20 to your computer and use it in GitHub Desktop.
Node.js static data - 猜猜看 index.js 最後印出什麼?
var d = require('./data');
module.exports = {
add: function(item){
d.data.push(item);
}
}
var Data = function(){}
Data.data = [];
module.exports = Data;
var c = require('./control');
c.add("AAA");
var data = require('./data').data;
/*
這個印出什麼?
*/
console.log(data);
@LinZap
Copy link
Author

LinZap commented Apr 11, 2016

猜猜看 index.js 最後印出什麼?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment