test53.js
var obj1 = {
id: 1,
name: "jie",
age: 18,
check: false
}
module.exports = obj1;
複製程式碼
test53s.js
var testFn = function() {
return "aa"
}
module.exports = testFn;
複製程式碼
test54.js
var obj2 = require("./test53.js");
var obj2s = require("./test53s.js");
console.log(obj2);
console.log(obj2s());
複製程式碼
呼叫
{ id: 1, name: 'jie', age: 18, check: false }
aa
複製程式碼