var power = function(base,exponent){ if(exponent === 0){ return 1; } else{ return base * power(base, exponent - 1); } }; power(2,2);

What does

*exponent - 1*do in the sixth line of the code?

And what does this mean?

To compute the power of a number base, we multiply it by itself raised to the

exponent - 1.

Also, how does this bit of code work in finding the power and how is it different from the method used above?

var power = function (base, exponent) { var result = 1; for ( i = 0; i < exponent; i++) { result = result * base; } return result; }; power(2, 4);

What does the

*for*loop do here? Please explain to me.

I'd love help. So please do help me. Any help would be appreciated a lot. Thank you.