Javascript 如何验证是否每次都在创建对象的新实例?

Javascript 如何验证是否每次都在创建对象的新实例?,javascript,Javascript,如何检查我是否正在创建对象的新实例 (function($, window, document,undefind){ var Yahoo = { } $.fn.queryTwitter = function(){ this.each(function(){ //$(this).text(Yahoo.name); // How to check if here if its a new instance of

如何检查我是否正在创建
对象的
新实例

(function($, window, document,undefind){
    var Yahoo = {
    }
    $.fn.queryTwitter = function(){
        this.each(function(){
            //$(this).text(Yahoo.name);
            // How to check if here if its a new instance of Yahoo object
        });
        return this;
    };
    $.fn.queryTwitter.options = {

    }
})(jQuery, window, document);
下面的代码每次都会创建Yahoo对象的新实例。但在我的例子中,我使用的是对象文字,我可以使用
object.create(yahoo)但如何验证是否每次都在创建对象的新实例?

function Yahoo (){    
}    
new Yahoo();

如果我能很好地理解你,这将是一种方式:

(function($, window, document,undefind){
    var originalYahoo = Yahoo = {};
    $.fn.queryTwitter = function(){
        this.each(function(){
            if(Yahoo !== originalYahoo) alert("New Instance!");
            ...   
        });
        return this;
    };
    ...
})(jQuery, window, document);

干杯

如果是文字,您肯定不会创建任何实例?
instance1===instance2
不会工作吗?您所说的“验证”是什么意思?什么是新的实例?比什么新?难道你不知道你是用
new
Object.create
来实例化对象,还是反复使用同一个对象?