Find the exponent mistake in a discounted return computation.
Codejavascript
// G = r0 + gamma*r1 + gamma^2*r2 + ...
function discountedReturn(rewards, gamma) {
let G = 0;
for (let t = 0; t < rewards.length; t++) {
G += Math.pow(gamma, t + 1) * rewards[t];
}
return G;
}
What is the bug in this discounted return calculation?