JSFiddle - React, Tailwind, and code Playground

JavaScript

var XHR = (function(){
    var instances = [];
    instances.push({
        getInstance: function(){
            return new ActiveXObject('Msxml2.XMLHTTP');   
        }
    });
    instances.push({
        getInstance: function(){
            return new XMLHttpRequest();
        }
    });
    
    instances.push({
        getInstance: function(){
            return new ActiveXObject('Msxml2.XMLHTTP');    
        }
    });
    
    for(var i = 0, l = instances.length; i < l; i ++) {
        try{
            var obj = instances[i].getInstance();
            return instances[i];
        }catch(e){ }
    }
})();

var xhrInstance = alert(XHR.getInstance());