In my code, I am using the setTimeout function as shown below:
setTimeout(function(){
//perform some task here
}, 1000);
Following this, I have another setTimeout function set up like this:
window.setTimeout(function(){
//some code goes here
}, 10000);
The challenge I am facing is that in the first setTimeout function, I need to read files and process them individually before moving on to the second setTimeout function. Once the first timeout is complete, I want to move on to the second function, do some processing there, and then return to the first function to process the next file. This cycle needs to continue for each file.
Currently, when I use a for loop inside the first setTimeout function, it processes all the files at once and only passes the control to the second timeout function with the last processed file. However, I want to process each file individually in this manner.
As a JavaScript beginner, I am seeking guidance on how to achieve this. Can anyone provide assistance?