问答
- react 用的哪个版本, react 从 15 到 16 新增了哪些功能
- 为什么要用 getDerivedStateFromProps 替换 componentWillReceiveProps
- 它为什么是一个静态的方法?
- react fiber 了解多少
- 说一说 dom diff, 它是怎么样的一个比对过程
- react-hooks 是用来做什么的,有什么作用
- hooks 的执行条件? 为什么?
- hooks 里面有哪些优化方案
- useCallback 是用来干嘛的
- typescript 的好处
- 范型是干嘛的
- 有用过其他工具去做代码质量提升吗
- 用 gitlab-runner 跑过测试吗
- webpack 中 loader 和 plugin 的区别
- webpack 怎么去做打包优化
- 了解 plugin 是怎么实现的吗?它是一个怎么样的执行过程
编程
const towSum = (
nums: number[],
target: number,
index: number = 0,
res: number[] = [],
n: number = 2
): [number, number] | boolean => {
if (traget === 0) return res;
if (nums.length === index || target < 0 || n === 0) return false;
return (
towSum(nums, target - nums[index], index + 1, res.concat(index), n - 1) ||
towSum(nums, target, index + 1, res, n)
);
};
console.log(twoSum([2, 3, 4, 5, 4], 9));
- 实现一个函数,接收一个函数作为参数,返回一个函数,当入参数量到达函数的形参个数时,执行函数体。
cosnt fn = function(a,b,c){
}
const curry = function (fn) {
const inner = (...args)=> {
return args.length>= fn.length?
fn(...args):
(arg)=>inner(...args,...arg )
}
return inner
};
const curried = curry(fn)