Loading

摘要: 找到helloWord的字母出现次数。 let str = 'hellowolrd' const arr = str.split('') console.log(arr); const obj = {} for (i = 0; i < arr.length; i++) { obj[arr[i]] ? 阅读全文
posted @ 2022-05-19 15:57 梧桐树211 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 数组是一维纯数字去重 arr1=[15,5,1,2,6,5,6,8,10,1] arr2=[] 思路: 对数组进行for循环遍历,判断新数组arr2里是否存在每一项,(indexOf()=-1或includes()=false)不存在把这一项加到新数组里。 for(i=0;i<arr1.length 阅读全文
posted @ 2022-05-19 10:07 梧桐树211 阅读(237) 评论(0) 推荐(0) 编辑