I've declared an empty array before a loop that then gets populated as the loop runs. My code works fine but when I lint using StandardJS it tells me that the array is never reassigned and should be declared as a const. If i did this then I wouldn't be able to add values to my array and my code wouldn't work. This also means i cant use standard --fix because it breaks my code.
let primeFactors = []
while (number > 1) {
if (isPrime(divisor)) {
if (number % divisor === 0) {
primeFactors.push(divisor)
number = number / divisor
} else {
divisor++
}
} else {
divisor++
}
}
Am i missing something here?