📌  相关文章
📜  检查对象是否为空 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:30.228000             🧑  作者: Mango

代码示例6
// Today, end of 2021 near, I'd go for
const objIsEmpty = o => !Reflect.ownKeys( o ).length;
// Will catch also non-empties with Symbol keys, e.g.
const FOO = Symbol('foo');
const obj = { [FOO]: 'foo', };
objIsEmpty(obj); // false
objIsEmpty({}); // true