I can't see what I am missing in this recursion call...
var power = function(b, e)
{
if (e===0)
{
return 1;
}
else
{
return b*power(b, e-1);
}
};
The first if statement is for catching numbers to the zero power (those always equal 1). But it's also the base case, so when e (exponent) reaches 0 the function exits and leaves me with the correct answer.
How is this returning the correct number and NOT the number 1? Every time, e is getting down to 0, but it returns the correct answer and NOT 1. Sorry I'm a noob, but I'm so confused...