Is there a way to view calculation steps?


#1

I’m going through various pages and tackling their exercises. One of my biggest challenges (after the syntax errors) is understanding where my codes breaks in the calculations.
For example. I’m currently trying to figure out how the second for loop is calculated. Any resources?

for(var count= 1; count<6; count++) {console.log(count)};
// 1
2
3
4
5

for(var count= 1; count<6; count++) {count};
/5


#2

if you are struggling that much, maybe don’t use shorthands:

for(var count= 1; count<6; count = count + 1)

and you can always add console.log(count); in the for loop body of the second loop if you want to see/visualize it? Seems a visualizer might also help you:

http://www.pythontutor.com/javascript.html#mode=edit


#3

Where had you been all my life?! The visualizer is what I needed!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.