< script> let arr = [ { id : 0 , name : "张三" } , { id : 1 , name : "李四" } , { id : 2 , name : "王五" } , { id : 3 , name : "赵六" } , { id : 1 , name : "孙七" } , { id : 2 , name : "周八" } , { id : 2 , name : "吴九" } , { id : 3 , name : "郑十" } , { id : 3 , name : "郑十" , p : 'kkk' } , ] ; function byReducesDeWeight ( arr, prop ) { let obj = { } ; return arr. reduce ( ( res, next, index ) => { obj[ next[ prop] ] ? "" : ( obj[ next[ prop] ] = true && next. hasOwnProperty ( prop) && res. push ( next) ) return res; } , [ ] ) } function byFilterDeWeight ( arr, prop ) { return arr. filter ( ( now, index, list ) => { return list. findIndex ( el => ( el[ prop] && el[ prop] == now[ prop] ) ) === index} ) } let arr2 = [ 1 , 2 , 4 , 5 , 73 , 3 , 4 , 3 , 2 ] function bySetDeWeight ( arr ) { return [ ... new Set ( arr2) ] } function byIndexOfDeWeight ( arr ) { let ar = [ ] arr. forEach ( element => { ar. indexOf ( element) == - 1 && ar. push ( element) } ) ; return ar} function byIncludesSimbleDeWeight ( arr ) { let ar = [ ] for ( let i = 0 ; i < arr. length; i++ ) { ! ar. includes ( arr[ i] ) && ar. push ( arr[ i] ) } return ar; } function byForDeWeight ( arr ) { let ar = [ ... arr] for ( let i = 0 , len = ar. length; i < len; i++ ) { for ( let j = i + 1 ; j < len; j++ ) { ar[ i] == ar[ j] && ( ar. splice ( j, 1 ) , j-- , len-- ) } } return ar} </ script>