标签:html cti color htm instance UNC php ret 顺序
var Factory = function(type,content){ if (this instanceof Factory) { var s = new this[type](type,content);//运算符优先顺序 return s; }else { return new Factory(type,content); } } Factory.prototype = { html:function(type,content){ this.content = content; this.type = type; this.show = function(){ console.log(this.type+this.content); } }, php:function(type,content){ this.content = content; this.type = type; this.show = function(){ console.log(this.type+this.content); } } } var p1 = Factory(‘html‘,‘哪家强?‘); p1.show(); var p2 = Factory(‘php‘,‘真的不错!‘); p2.show();
标签:html cti color htm instance UNC php ret 顺序
原文地址:https://www.cnblogs.com/jokes/p/9671141.html