function getStringNum() { let stringArr = [] for(let i=0; i< 1000; i++) { let list = '' for(let j= 0; j< 6; j++) { let num = Math.floor(Math.random() * 10) list = list.concat(num) } if(stringArr.indexOf(list) === -1) { stringArr.push(list) } else { console.log('string:'+list) console.log("stringArr:"+stringArr[stringArr.indexOf(list)]) i-- } } console.log(stringArr.length) return stringArr } let arr = getStringNum()