The array contains random values
like let checkTypes = ['a','b','c'];
. (The length of the array is also random.)
And, The array tries to call a functionthis.switch()
by the number of arrays.
So, My code is ...
for (let i = 0; i <= checkTypes.length-1; i++) {
window.setTimeout(() => {
this.switch(checkTypes[i]);
if (i != 0 && i != checkTypes.length -1) window.setTimeout(() => this.switch(checkTypes[i+1]))
});
}
The following error remains([Violation] 'setTimeout' handler took <N>ms
) in the developer's tool console and feels that my code does not seem to work normally.
Can I change the code so that I don't get this error?