what exactly is the issue with your code? but fundamentally, i don’t think it is appropriate you apply “.length” to a an array that is already converted to a string. You might need to take out the “toString()” array method for the condition segment of the loop and that of the "if " condition embedded in the loop too.
you provide an incomplete code snipped, but i assume your loop is found inside a function, as you return values. Once a function returns a value, it stops, any code found inside it, past the return statement is not executed. If you want your loop to run entirely, you shouldnt stop the function(return value) inside it. .
PS: instead of performing the Number.toString() method several times in your code, its better practice to store it in a variable and refer to the variable instead, ofc unless this would produce some unwanted side effects to your results.
let stringOfDigits=digitalOfNumbers.toString()
stringOfDigits.length
stringOfDigits[3]
...