--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: sumOfPrimes.js --- # Input ```jsx function sumOfPrimes(max) { let total = 0; OUT: for (let i = 1; i <= max; ++i) { // +1 for (let j = 2; j < i; ++j) { // +2 if (i % j == 0) { // +3 continue OUT; // +1 } } total += 1; } return total; } ``` # Diagnostics ``` sumOfPrimes.js:1:10 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Excessive complexity detected. > 1 │ function sumOfPrimes(max) { │ ^^^^^^^^^^^ 2 │ let total = 0; 3 │ OUT: for (let i = 1; i <= max; ++i) { // +1 i Please refactor this function to reduce its complexity score from 7 to the max allowed complexity 6. ```