let index = 1
cont ticker = setInterval(_ => {
console.log(index++)
if(index >= 10) {
clearInterval(ticker)
}
}, 1000)
function loadJson() {
return new Promise(reslove => {
setTimeout(() => {
reslove("json")
},
5000)
})
}
const getInfo = new Promise(reslove => {
setTimeout(_ => {
reslove("info")
},
3000)
})
getInfo.then(data => {
console.log(data)
return loadJson()
})
.then(data => {
console.log(data)
})