I am making a binary translator but have run into a scope issue.
Here is my repl: https://repl.it/@Michael_Nicol/Binary-Translator-Debug
Keep in mind that this is just a copied version of the program where I singled out the bug. There is a lot more code but I removed it so we could better figure out what the problem is.
When I go to hit run, what it should do is run a loop to go through my array. Their is two loops, one of which is embedded in the other.
- The first outer most loop (5) should
console.log(array[i])
to display the byte. - Then the embedded loop (15) should run,
console.log(array[i][j])
to display each bit. For every iteration of the outer loop, this loop is completely run. - Lastly, the process repeats until I run out of bytes. It should return “Finished” (21)
However, I have run into an issue. On the embedded loop for going through the bytes, it runs once and then returns that it cannot read the length of 'undefined." I have no idea why this is happeneing. I thought it was something to do with scope and I swapped let
with var
and still got the still issue.