判断对象obj是否为空
const isEmpty = obj => Reflect.ownKeys(obj).length === 0 && obj.constructor === Object
console.log(isEmpty( { } ) ) // true
console.log( isEmpty( { name : "小明" } ) ) // false
获取两个日期之间的天数差
const daysBetween = (date1, date2){
return Math.ceil(Math.abs(date1 - date2) / (1000 * 60 * 60 * 24) )
}
网友评论