💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
![mark](http://qiniu.newthink.cc/blog/20171123-095116349.png) ## 代码 ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> var paylist = [ {paymode: '1', payname: "现金", paymoney: "20"} , {paymode: '2', payname: "支付宝", paymoney: "50"} , {paymode: '1', payname: "现金", paymoney: "40"} ]; /* * JSON数组去重 * @param: [array] json Array * @param: [string] 唯一的key名,根据此键名进行去重 */ function uniqueArray(array, key) { var result = [array[0]]; for (var i = 1; i < array.length; i++) { var item = array[i]; var repeat = false; for (var j = 0; j < result.length; j++) { if (item[key] == result[j][key]) { repeat = true; break; } } if (!repeat) { result.push(item); } } return result; } </script> </body> </html> ```