Search⌘ K

Exercise: Debugging 101

Explore how to debug JavaScript by identifying and fixing scope-related errors in a function that calculates squares. Understand how variable scope affects code behavior and learn to make precise corrections without rewriting the entire code.

We'll cover the following...

Task

The mathematician needs help. He wrote some code to calculate the square of two numbers. However, he wrote lots of unnecessary statements. His math and logic are correct. He correctly used loops and the addition statement to find the square while also using a function to sum two ...