new Promise(function(resolve, reject){setTimeout(function(){a = 1; resolve(null)})}) .then(function(){console.log(a)})