The issue was about the variable declaration outside of the scope it was used.
The declaration was with the const keyword which is only accessible in the block it is defined.
[ ] The solution was to move the variable all the way down inside the block or use the var keyword which is not limited to the scope in which it is defined.
The issue was about the variable declaration outside of the scope it was used. The declaration was with the
const
keyword which is only accessible in the block it is defined.var
keyword which is not limited to the scope in which it is defined.