SOURCE

/*
* 判断空数组
*/
let arr = []
console.log(Array.prototype.isPrototypeOf(arr) && arr.length === 0)

/*
* 判断空对象
*/
let obj = {}
console.log(Object.prototype.isPrototypeOf(obj) && Object.keys(obj).length === 0)

/*
* 小技巧 判断空数组和空对象
*/
var item = [];
console.log(JSON.stringify(item) === '[]'); 

var item = {};
console.log(JSON.stringify(item) === '{}');

console.log(Object.keys({a:1,b:2}).length)
console 命令行工具 X clear

                    
>
console