var DOM_N$ = function(selector){
this.selector = selector;
return "jello world";
}
DOM_N$.prototype = {
getSelector: function(){
return this.selector;
}
}
function N$(selector){
return (new DOM_N$(selector));
}
N$('element').selector; //wont return selector because of return
N$('element'); //returns element
当我没有调用其他方法但我的返回正在中断我的对象方法时,我试图从对象返回值。
答案 0 :(得分:1)
对于DOM_N $是构造函数,它应该不返回任何内容
var DOM_N$ = function(selector){
this.selector = selector;
}