beginner40 minby DevFox

Reading code: tracing a loop by hand

Read a loop you cannot run by being the computer for a minute: write a trace table with a column for every box and a row for every turn, starting from what each box holds before the loop. Trace the check too, since it runs once more than the body, and use the table to find the exact turn where a loop goes wrong, such as one that reads past the end of its list and prints NaN. Closes Module 4 with a one-page cheat sheet of the whole module.

  • TypeScript
  • Fundamentals
Reading code: tracing a loop by hand. Read this lesson at .