title: javascript variable changing value after changes in original variable
body: <p>I am having trouble maintaining the original value of a variable after making new changes to the original variable.</p>
  
  <p>Code:</p>
  
  <pre><code>(...)
  data = Illumination.calculate_N(data)
  data = Illumination.calculate_pi(data)
  data = Illumination.calculate_kwh(data)
  data = Illumination.calculate_ca(data)           
  
  let data_base = data
  
  let ca_base = data.ca
  let kwh_base = data.kwh
  let pi_base = data.pi
  
  (...)
  
  data = Illumination.calculate_N(data)
  data = Illumination.calculate_pi(data)
  data = Illumination.calculate_kwh(data)
  data = Illumination.calculate_ca(data)            
  
  let data_proposto = data
  
  let ca_proposto = data.ca
  let kwh_proposto = data.kwh
  let pi_proposto = data.pi
  
  -----------------------------------
  EXAMPLE:
  static calculate_ai(data){
    data.ai = data.areaTotal*data.au
    return data
  } 
  </code></pre>
  
  <p>It was expected that the original variable (date) would have its values ​​changed, and this happens correctly, however, the variables data_base and data_proposto are not keeping their values</p>
  
  <p>Both variables at the end of the calculation have the same values ​​as the variable date</p>
  
  <p>The variables ca_proposto, ca_base, and the like store their values ​​correctly</p>
  
  <p>Any idea?</p>
  
  <p>The only interactions of the variables data_base and data_proposto were their creations with the data variable and their return of the function</p>
  
  <p>OBS: If I use console.log () to view the value of the data_base variable before redoing the new calculations (Illumination.calculate_N (data)), the value of the variable appears correctly as it should, it is changed shortly after these calculations.</p>