I want the below function to be executed synchronously. Initially the 1st set time out should wait for 10 sec and call the function name which waits for 2 sec and returns back. I tried the below.
var ty = [1000, 1500, 200]
for (var i = 0; i < ty.length; i++) {
setTimeout(function(){
console.log(i)
}, ty[i]);
name(i);
}
function name(i) {
setTimeout(function() {
console.log('the page name is' + i);
}, 2000)
}