Debugging: ESLint Warning “Function declared in a loop contains unsafe references to variable(s)…no-loop-func”
问题 Building a Sort-Visualizer in React using the Create-React-App [https://roy-05.github.io/sort-visualizer/ ] I'm animating each iteration of the loop using setTimeouts. On dev console I get the following warning: Line 156:32: Function declared in a loop contains unsafe references to variable(s) 'minimum', 'minimum', 'minimum', 'minimum' no-loop-func Here's the code-snippet: for(let i=0; i<arr.length-1; i++){ let minimum = i; //Declare minimum here setTimeout(()=>{ for(let j = i+1; j<arr.length