Mistake in Replace Loops using Recursion

Hello! I have fond some mistake in “Replace Loops using Recursion” from “Basic JavaScript”

However, notice that multiply(arr, n) == multiply(arr, n - 1) * arr[n - 1] . That means you can rewrite multiply in terms of itself and never need to use a loop.

In my opinion this equation shold look like multiply(arr, n) == multiply(arr, n - 1) * arr[n]

That suggestion is not correct. Arrays index at zero in Javascript. The provided text is correct.

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