Javascript / Ajax: assigning value to a new object and deleting one of the element -


i'm making ajax request , assigning dataset of request new object {} using object.assign() method , subsequently wants delete 1 of item in new object. when console.log() original dataset, value deleted there aswell. why when i'm assigning using object.assign() method? how can stop js that?

$.ajax({                 url: "{% url 'filtered_financial' %}",                 method: 'get',                 data : {                     airline_category: 1,                         },                 success: function(dataset){      var datacopy = object.assign({}, dataset);      delete datacopy.financial_year      console.log(dataset) // financial_year element deleted      )}; 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -