Reputation: 1593
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
I am trying to return the values from an object when no other methods are being called but my return is interrupting my objects methods.
Upvotes: 1
Views: 39
Reputation: 1990
For DOM_N$ be a constructor, it should returns nothing
var DOM_N$ = function(selector){
this.selector = selector;
}
Upvotes: 1