Modify query param in pre-request script

So Iโ€™m pretty new to postman scripting, but I think this might work for you. If I know the index of my parameter to update, as it seems you are wanting to do, I have been successful with

pm.request.url.query.idx(0).value = "newValue";