判断对象中是否存在某个值
obj.hasOwnProperty("值")//false  不存在

判断对象是否为空,长度为0
let obj={};   //
   方法1:
   Object.getOwnPropertyNames(obj).length  //长度  
 console.log(Object.getOwnPropertyNames(obj).length  )  //结果为0
 
 方法2:
   Object.keys(obj).length  //长度  
 console.log(Object.keys(obj).length)  //结果为0
 
 
 方法3:
 jq:
  $.isEmptyObject(obj);   //为空返回true,否则返回false
  
  
对象去重
const dataSource=[
  {"label":"测试","value":"test","id":736},
  {"label":"用户","value":"enn.icome.User","id":730},
  {"label":"创建数据对象测试","value":"createDataObjectTestA1","id":728},
  {"label":"企业","value":"enterprise","id":727},
  {"label":"企业","value":"test-ygego-data-enterprise","id":725},
  {"label":"企业","value":"test-ygego-data-enterprise","id":725},
  {"label":"企业","value":"test-ygego-data-enterprise","id":725},
  {"label":"审批","value":"test-ygego-data-approve","id":724},
  {"label":"test-ygego-rule-approveProcess-object","value":"test-ygego-rule-approveProcess-object","id":723},
  {"label":"打分项","value":"Score","id":690},
  {"label":"OYO APP会员转化urn","value":"OyoMemberConversion","id":689}
]
var hash = {};
const dataSource2 = dataSource.reduce(function(item, next) {
    hash[next.value] ? '' : hash[next.value] = true && item.push(next);
    return item
}, [])


对象里面如果有两个相同属性名字,那么第二个属性名字会覆盖第一个
eg:
  let a={
        name:'15',
        b:"20",
        b:"202"
    }
   console.log(a)   //结果:{name:'15',b:"202"}

 

时间一直在走,没有尽头,只有路口