Hello,
New to coding and first post so please go easy on me if I’m not posting correctly.
This code is from the recursion challenge in basic JavaScript, but my question is not about recursion (at least at the moment but I’m sure that’ll change, and I changed the code to add instead of multiply). I think I’m getting confused when it comes to distinguishing between the iteration of a loop and an element in an array. I keep thinking the array should start at [0] and so total *= arr[0] should equal 1 + 2 as 2 is my first element in my array. This isn’t what happens however. The console returns 1. Is this because at iteration [0] when n equals 0, i is not less than n and so the code won’t execute the iteration. Does this make arr[0] equal to 0 or null? Not sure how to think about this properly.