mardi 17 juillet 2018

pass array by reference and save the actual array JAVASCRIPT

I am passing an array to function as in javascript arrays are by default get passed by reference i tried to make a copy of array but at the end the operations performed in function effects the actual array data
All i want to do is save the actual state of array

Here is my copy code

  let  arrcopy =new Array( items.dt);
    citem = binarySearch(arrcopy[0], ind.ItemID);




Aucun commentaire:

Enregistrer un commentaire