JSFiddle - React, Tailwind, and code Playground

JavaScript

let setHttp = () => {
  return new Promise(function(resolve, reject) {
    setTimeout(function() {
      resolve('foo');
    }, 1000);
  });
}

let setHttps = () => {
  return new Promise(function(resolve, reject) {
    setTimeout(function() {
      resolve('bar');
    }, 2000);
  });
}

const run = () => {
	
	let config = {};
	config.http = setHttp();
	config.https = setHttps();
	
	return config;
		
};

function getConfig() {
	return run();
}

var cfg = getConfig();
if(cfg.http ==='foo'){
	console.log("xD")
}else{
	console.log("nie xD = :(")
}