此问题在此处已有答案:
Return an object key only if value is true(5个答案)
Get all keys from object that have a specific value [duplicate](1个答案)
18小时前关门了。
我想打印JSON中的所有空值。如果所有值都不是空的,那么它应该打印JSON没有空字段。
let obj = {
"name" : "abc",
"sub_name" : "some name",
"language" : "",
"skills" : "",
"device" : "device_name",
"color" : "",
}
I want to have all the empty keys in JSON
output :
[language, skills, colour] have empty values
1条答案
按热度按时间rdlzhqv91#
我们可以合并
Object.keys()
和Array.filter()
来实现