I have the following files in the same directory:
data.js
var anArray = [1,2];
module.exports = anArray;
mod1.js
var data = require('./data');
module.exports = data;
mod2.js
var data = require('./data');
module.exports = data;
main.js
var mod1 = require('./mod1');
var mod2 = require('./mod2');
When I do mod1 === mod2 it is true Why is that? My initial belief was that mod1 and mod2 files should contain an array but that are different (different references to the array objects).
Aucun commentaire:
Enregistrer un commentaire