Yes, Math.pow() is the best way to solve this problem!
There are three reasons why your for loop wasn’t working:
1. The loop will execute 12 times, not 13, because you’re testing if i is less than x. For it to execute the last time, you want to test if i is less than or equal to x (written “i <= x”).
2. The double-equal sign in the body of the loop tests equality, it does not assign a value. R will never change. Use a single equal sign here instead.
3. The algorithm has a bug; you’re not multiplying it by itself x times, you’re squaring it X times. You need a separate variable to track the original value as well as the accumulating value.
Again, Math.pow() is the right way to solve it, but here’s the for() loop solution:
R = thisComp.layer("settings").effect("R")("Slider");
var x = 13;
var accumulatingValue = 1;
for (i=1; i <= x; i++) {
accumulatingValue = accumulatingValue * R; // this can also be written like this: "accumulatingValue *= R;"
};
[value[0], value[1] * accumulatingValue];