Sorry, I don’t know JavaScript so I can’t help you there. Other people will hopefully chime in below with some scripting templates for you. You may also want to post here as well, where there are several scripting experts.
However, in case somebody in the future is reading this thread and they’re looking for a low-code, non-scripting way of doing this, this can be done by using the DataFetcher extension for Airtable or by using Make’s HTTP tool.