Is there is some way to do a fetch request in JavaScript with dynamic parameters?
for example:
'''fetch (/api/$parameter1/$parameter2)'''
when both parameters are declared in the code above them (it determine in the previous code).
You can use template literals, it allows you to interpolate strings with variables. (more here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
let parameter1 = 'example-param1';
let parameter2 = 'example-param2';
fetch (`/api/${parameter1}/${parameter2}`)