readLog();
async function readLog() {
var arr = [1, 2, 3, 4, 5, 6]
for (var i = 0; i < arr.length; i++) {
const logStr = await this.sleepFun(i)
console.log('logstr---' + updateTime(), logStr)
}
}
function sleepFun(logStr) {
var times =1;
return new Promise((res) => {
return setTimeout(() => {
res(logStr)
}, times * 1000)
})
}
function updateTime() {
var now = new Date();
var hours = now.getHours().toString().padStart(2, '0');
var minutes = now.getMinutes().toString().padStart(2, '0');
var seconds = now.getSeconds().toString().padStart(2, '0');
return hours + ':' + minutes + ':' + seconds;
}