Here is my function which returns a promise:
function myFunction(i){ return new Promise(function(resolve,reject){ setTimeout(function(){ console.log(i