So here is the thing. Am creating an instance of an object var newInstance = new MyObject() on click of a button, but i want to make sure that when the button is clicked, it checks to see if that particular instance newInstance of that object MyObject has been created already, which if it has been created, prevent it from creating that instance again. I hope its clear enough. 
This is what i have tried so far:
button.addEventListner("click", function(){
   if(newInstance instanceof MyObject){ // also tried newInstance instanceof Object
       return false; // this didn't work, i tried using preventDefault(); and to no avail
       // at this point i don't want the instance to be created anymore
   }
   else{
       var newInstance = new MyObject(); // create the instance
   }
});
 
    