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