I am new to NodeJs. I want to push elements in files array in order of url. But i am getting random order . Below is the code for same. Can anyone suggest what i am doing wrong here.
const mergePdf =async  (urlArray, files) => {
  for (let i = 0; i < urlArray.length; i++) {
    try {
      const pdfBytes = await fetch(urlArray[i]).then((res) => {
        return res.arrayBuffer();
      });
      let bytes = new Uint8Array(pdfBytes);
      files[i]=bytes;
    } catch (err) {
      console.log(err);
    }
  }
}
 
    