Another answer, using sequential executor nsynjs:
function getExample(){
var response1 = returnPromise1().data;
// promise1 is resolved at this point, '.data' has the result from resolve(result)
var response2 = returnPromise2().data;
// promise2 is resolved at this point, '.data' has the result from resolve(result)
console.log(response, response2);
}
nynjs.run(getExample,{},function(){
console.log('all done');
})
function synchronousCode() {_x000D_
var urls=[_x000D_
"https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js",_x000D_
"https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js",_x000D_
"https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"_x000D_
];_x000D_
for(var i=0; i<urls.length; i++) {_x000D_
var len=window.fetch(urls[i]).data.text().data.length;_x000D_
// ^ ^_x000D_
// | +- 2-nd promise result_x000D_
// | assigned to 'data'_x000D_
// |_x000D_
// +-- 1-st promise result assigned to 'data'_x000D_
//_x000D_
console.log('URL #'+i+' : '+urls[i]+", length: "+len);_x000D_
}_x000D_
}_x000D_
_x000D_
nsynjs.run(synchronousCode,{},function(){_x000D_
console.log('all done');_x000D_
})
_x000D_
<script src="https://rawgit.com/amaksr/nsynjs/master/nsynjs.js"></script>
_x000D_