binding instead of pushing

Hello,

when I’m pushing one element of the source array to a new array it actually creates a binding. It means if I change later the values in the destination array it also changes it in a source array. It makes me crazy and I don’t understand why it is so?
Here the example of the code where it is occuring:

`var mat = $data.listOfMaterialsByPlantQuery;
var tempArray = [];
var line;
if ($data.sourceFromZpro === true)   {
    for (var k = 0; k < mat.length; k++) {
        if (mat[k].matnr == $data.chosenZproCode) {
        line = mat[k]; 
        tempArray.push(line);
        }
    }
}
return tempArray;` `

`

Mariusz

What is the name of the form variable you are updating with this JavaScript?
Can you share your project as a .bos file for example using Google Drive or Dropbox?

Thanks