假设我在file1.js中定义了一个类
function Customer(){
this.name="Jhon";
this.getName=function(){
return this.name;
};
};
Run Code Online (Sandbox Code Playgroud)
现在,如果我想在file2.js中创建一个Customer对象
var customer=new Customer();
var name=customer.getName();
Run Code Online (Sandbox Code Playgroud)
我得到例外: Customer is undefined, not a constructor.
但是,当我在file2.js中创建一个客户对象并将其传递给file1.js然后它的工作.
file1.js
function Customer(){
this.name="Jhon";
this.getName=function(){
return this.name;
}
}
function customer(){
return new Customer();
}
file2.js
var customer=customer();
var name=customer.getName();
Run Code Online (Sandbox Code Playgroud)
但我想使用新的Customer()在file1.js中创建一个客户对象.我怎样才能实现这一目标?
我收到错误:无法建立隧道套接字,尝试在node.js中安装模块时导致= getaddrinfo ENOTFOUND 这似乎是一些代理错误.我在浏览器设置中检查,代理被禁用.但是当我在命令提示符下检查npm config get proxy时,得到192.168.98.5:8080.如何禁用此功能?
在尝试从Visual Studio部署应用程序时,我收到了一个错误.我已经设置了开发人员模式,并且还从packages文件夹中删除了应用程序包,但它仍然无效.
这是错误消息:
错误:DEP0700:应用程序注册失败.部署注册操作与目标卷C:在包App_1.0.0.2_x64__m0fsgersa29a0上:( AppxManifest.xml)失败,错误0x80070002.有关 诊断应用部署问题的帮助,请参阅http://go.microsoft.com/fwlink/?LinkId=235160.(0x80073cf9)
我还需要设置其他内容吗?