I\'m learning algorithms and doing JavaScript exercise questions, and I don\'t understand how one reaches the correct answer for a particular algorithm.
The question