Pass variable to create URL in a GET API

I'm leveraging code from Retry API call? that retries [n] times (10 in the example below) and then throws an error. Thanks for the alternate approach as well.

const var= "some parameter";
const maxTries = 10;                   // how many times should we retry

for (let i = 0; i < maxTries; i++) {
  const result = await functionForGET(var);          // try to run the function(*params*)
  if (result.data.state === "running") {             // set response that triggers repeat
    await new Promise((r) => setTimeout(r, 10000));  // if met try again
    continue;                                        // otherwise move on
  }
  return result;
}

throw new Error("Max tries reached");  // Uh-oh. Tried [n] times and it didn't work