// 判断数组中是否有同一项,例如:["111","22","33","111"] 返回true export const isRepeat = arr => { var hash = {} for (var i in arr) { if (hash[arr[i]]) //hash 哈希 return true hash[arr[i]] = true } return false }
// 判断数组中是否有同一项,例如:["111","22","33","111"] 返回true export const isRepeat = arr => { var hash = {} for (var i in arr) { if (hash[arr[i]]) //hash 哈希 return true hash[arr[i]] = true } return false }