scrimba
The JavaScript Language [JSL] Module 5 (Arrays)
Debugging Rabobi
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Debugging Rabobi
by
AboutCommentsNotes
Debugging Rabobi
by
Expand for more info
instructions.md
run
preview
console
# Practice Challenge: Debugging Rabobi's Escape**

Rabobi, the Xhosa Spider-Man, finds himself entangled in the Green Goblin's trap. His movements are recorded in an array, but there's a bug preventing him from untangling himself efficiently. Your mission is to review and refactor the code to help Rabobi escape.

**Task**: Debug and refactor the code to ensure Rabobi escapes the trap correctly.

**Instructions**:

1. Review the provided code in the starter template, which includes an array `rabobiMovements` and two functions: `findFirstPositive` and `untangleRabobi`.

2. **Task 1**: Debug the code to find and fix the bug that prevents Rabobi from escaping. Pay attention to loop conditions and array manipulations.

3. **Task 2**: Refactor the code to make it more readable and efficient. Apply best practices, such as using descriptive variable names and modern JavaScript features like array methods.

4. Test the code to ensure that Rabobi successfully escapes the Green Goblin's trap.

This code defines an initial array `rabobiMovements`, and two functions (`findFirstPositive` and `untangleRabobi`) to untangle Rabobi from the Green Goblin's trap. The code attempts to find the first positive movement in the array and calculate Rabobi's final position after untangling.

The challenge is to review and refactor this code to fix the bug and help Rabobi escape efficiently.

Make sure to follow the debugging steps and apply best practices to improve the code's readability and efficiency.
Console
!
ReferenceError: raboobooMovements is not defined
,
/index.html
LIVE