Javascript delete object property not working

后端 未结 5 1757
难免孤独
难免孤独 2021-01-01 13:31

I\'m running some project on MEAN.js and I\'ve got a following problem. I want to make some user\'s profile calculation and the save it to database. But there\'s a problem w

5条回答
  •  滥情空心
    2021-01-01 14:05

    Had a similar problem. This worked for me:

    // create a new copy  
    let newUser= ({...user}._doc); 
    
    // delete the copy and use newUser that thereafter. 
    delete newUser.password; 
    
    

提交回复
热议问题