You did the right thing and showed your code to us, and that’s how it works on the job: You let other devs in your team review your code, because you sometimes get blind for your own mistakes.
Another tip:
Use “const” as your standard variable. The re-assignable “let” is best left to loops and other structures where reassigning it is part of the method.
Using “const” can avoid errors and confusion in large, professional code bases with many contributors.