score:0

Accepted answer

i just figured out how it's done, sry guys

this how i do it

let secfilm = result.data.films
let secpilot = result.data.pilots

  function secure(arr){
    for (let k = 0; k < arr.length; k++) {
      arr[k] = arr[k].replace(/http/g, "https");
    }
  }

  secure(secfilm, secpilot)

so i don't have to make async function, thank you to @thomas i know it's not the best method, but i think it's better than before

score:0

function converthttp(arr=[]) {
    arr.foreach((val, index, arr) => {
        arr[index] = val.replace(/http/g, "https");
    });
}

i guess you don't need an async function instead you can use the above function if u need to change object value everywhere otherwise you can use a map function which creates a new array of value containing https and the original array also will be retained with http

map function

function converthttp(httparr=[]) {
    return httparr.map(val => val.replace(/http/g, "https"));
}

correct me if i am wrong. thank you


Related Query

More Query from same tag