0

如果我有一个值为

{"__v":0,"_id":"528277c808cab8ac2b000001","password":"password",
"userId":5,"userName":"Austinsss","$$hashKey":"00F"}

我怎样才能从对象中完全删除 "$$hashKey":"00F" 。

4

3 回答 3

3

使用delete(MDN)

var foo = {"__v":0,"_id":"528277c808cab8ac2b000001","password":"password",
"userId":5,"userName":"Austinsss","$$hashKey":"00F"};

delete foo.$$hashKey;

如果您的键中有奇数字符,您也可以使用括号表示法:

delete foo['$$HashKey'];
于 2013-11-14T22:30:42.663 回答
3

怎么样

delete obj.$$hashKey
于 2013-11-14T22:30:50.807 回答
3

delete它!

delete objname["$$hashKey"];
于 2013-11-14T22:31:30.030 回答