Object 节点对象模块返回对象

Object 节点对象模块返回对象,object,module,undefined,Object,Module,Undefined,是否可以将节点对象从一个文件返回到另一个文件 例: 文件1 文件2 在我的代码中,new现在没有定义。是否有方法返回新对象?文件\u 1应为: myObject = function(x){ this.x = x this.change = function(){ return myObject("new_value"); } } module.exports = myObject; 你在用哪种语言?我在用Javascript。刚刚找到答案。愚蠢的我:我

是否可以将节点对象从一个文件返回到另一个文件

例:

文件1

文件2

在我的代码中,new现在没有定义。是否有方法返回新对象?

文件\u 1应为:

myObject = function(x){
    this.x = x
    this.change = function(){
        return myObject("new_value");
    }
}
module.exports = myObject;

你在用哪种语言?我在用Javascript。刚刚找到答案。愚蠢的我:我没有返回新的myObjectOh,我忘在这里了,但在我的代码中确实有它。
F1 = require('file_2');
f1 = new F1("some_value");
new = f1.change();
myObject = function(x){
    this.x = x
    this.change = function(){
        return myObject("new_value");
    }
}
module.exports = myObject;