摘要: 2.对象数组去重 const arr = [{id: 1},{id: 2},{id: 3},{id: 2}]; const hash = {}; const arrResult = arr.reduce((preVal, curVal) => { hash[curVal.id] ? '' : has 阅读全文
posted @ 2018-04-11 21:27 Alice_Xu 阅读(190) 评论(1) 推荐(0) 编辑
摘要: function test() { var name = 'alice'; return { getName : function() { console.info(name); }, setName : function(newName) { name = newName; } }};var pe 阅读全文
posted @ 2018-04-11 20:54 Alice_Xu 阅读(184) 评论(0) 推荐(0) 编辑
摘要: var Person = { name : 'alice', say : function(txt1,txt2) { console.info(txt1+txt2); console.info(this.name); }}var Dog = { name : 'tom', say : functio 阅读全文
posted @ 2018-04-11 20:27 Alice_Xu 阅读(208) 评论(0) 推荐(0) 编辑