The difference between two ways of Object reset and emptying of js objects

the following code indicates that the pop-up box will be emptied when the pop-up box is closed, that is, clearFlag is false, in case there is cache information the next time the pop-up box is opened.
but when the pop-up box fills out the form, save and get the information. Once the method is cleared, the save will not get the data, which is the""value. Method 2 can get the value normally.
could you tell me the specific difference between the two methods:

   clearFalg(){  
            if(this.clearFalg == false){
                //: this.subForm.tempInventoryId ="" 
                //:
                          this.subForm = {
                             tempInventoryId:""
                           }
                
            }
        }
Jun.25,2021

you must have done the assignment

var data = this.subForm;

this.subForm.tempInventoryId =''

data.tempInventoryId //''

reference problem
the first data and this.subForm use the same references, so they influence each other
the second this.subForm points to a new reference again, so they don't affect

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38264-2c0d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38264-2c0d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?