This rule was introduced in ESLint 0.0.9. For example: for ( var i = 0 i console.log(foo)) Įxamples of correct code for this rule: /*eslint no-loop-func: "error"*/ /*eslint-env es6*/ var a = function( ) // OK, all references are referring to never modified variables. Career Karma matches you with top tech bootcamps. The forEach loop can only be used on Arrays, Sets, and Maps. Writing functions within loops tends to result in errors due to the way the function creates a closure around the loop. The JavaScript forEach loop is an Array method that executes a custom callback function on each item in an array. Disallow Functions in Loops (no-loop-func)
0 Comments
Leave a Reply. |