We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
新版本的生命周期如何跟老版本对应
hooks优点 useEffect如何进行深比较
constructor指向
flex实现垂直水平居中
// 1.在一个二维数组中,每一行都按照从左到右递增,每一列都从上到下递增的顺序排序, // 完成一个函数,输入这个二维数组和一个整数,判断数组中是否含有该整数 function isInArray(arr, num){ let middle = Math.floor(arr.length / 2); if(arr[middle].includes(num)){ return true; }else{ if(num > arr[middle][arr[middle].length - 1]()){ isInArray(arr.slice(middle), num); }else{ isInArray(arr.slice(0, middle), num); } } } function isInArray2(arr, num){ for(let i = 0; i < arr.length; i++){ if(arr[i][arr[i].length - 1] < num){ continue; }else{ return arr[i].includes(num); } } return false; } // 2. 实现一个深拷贝函数,可以对象的深拷贝 function deepClone(source){ if(!source || typeof source !== 'object'){ throw new Error('error arguments'); } let target = Array.isArray(source) ? [] : {}; for(let prop in source){ if(source.hasOwnProperty(prop)){ if(typeof source[prop] === 'object'){ target[prop] = deepClone(source[prop]); }else{ target[prop] = source[prop]; } } } return target; } // 3.实现promise.all Promise.all = function(promises){ let results = []; let length = promises.length; let counter = 0; function processAll(index, value, resolve){ counter++; results[index] = value; if(counter === length){ resolve(results); } } return new Promise((resolve, reject) => { for(let i = 0; i < length; i++){ promises[i].then(processAll(i, value, resolve), reject); } }) } // 4.求两个数组的交集和并集 function jiaoji(arr1, arr2){ let result = []; for(let i = 0; i < arr1.length; i++){ if(arr2.includes(arr1[i])){ results.push(arr1[i]); } } } function bingji(arr1, arr2){ return Array.from(new Set(arr1.concat(arr2))); } // 5.给定一个数组,获取数组中重复的数及重复次数,将数和重复次数按照键值对的方式返回;例如:[2, 10, 35, 2, 2, 35],返回:{2:3,10:1,35:2} function repeatKey(arr){ let obj = {}; arr.forEach(item => { obj[item] ? obj[item]++ : obj[item] = 1; }); return obj; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1. 数据处理常用什么ES6方法
2. var let const 区别
3. 画图表除了使用echarts还引入了什么库
4. react setState后都干了什么,执行了什么生命周期
新版本的生命周期如何跟老版本对应
5. pureComponent和component的区别
6. hooks相关
hooks优点
useEffect如何进行深比较
7. new实现思路
constructor指向
8. 移动端布局方式
flex实现垂直水平居中
9. meta viewport 属性解读
10. 写过的react业务组件,复杂度和遇到的难点是怎么解决的
11. 写代码
The text was updated successfully, but these errors were encountered: