摘要: 1、找到重复的元素 只找到是哪几个重复的元素 const findDup = (list = []) => { const result = []; list.forEach(item => { if(list.indexOf(item) !== list.lastIndexOf(item) && 阅读全文
posted @ 2021-03-25 21:28 香香香。。。。香菜 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 普通的实现 累加n次初始值 String.prototype.nRepeat = function(count){ let str = this.valueOf(); let res = ''; while(count > 0){ res =res + str; count--; } } 优化方案 阅读全文
posted @ 2021-03-25 20:06 香香香。。。。香菜 阅读(77) 评论(0) 推荐(0) 编辑