how to remove json object key and value.?

后端 未结 6 1391
忘了有多久
忘了有多久 2021-02-01 02:02

I have a json object as shown below. where i want to delete the \"otherIndustry\" entry and its value by using below code which doesn\'t worked.

var updatedjsono         


        
6条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-01 02:21

    Here is one more example. (check the reference)

    const myObject = {
      "employeeid": "160915848",
      "firstName": "tet",
      "lastName": "test",
      "email": "test@email.com",
      "country": "Brasil",
      "currentIndustry": "aaaaaaaaaaaaa",
      "otherIndustry": "aaaaaaaaaaaaa",
      "currentOrganization": "test",
      "salary": "1234567"
    };
    const {otherIndustry, ...otherIndustry2} = myObject;
    console.log(otherIndustry2);
    .as-console-wrapper {
      max-height: 100% !important;
      top: 0;
    }

提交回复
热议问题