31 分片思想解决大数据量渲染问题
32 将虚拟 Dom 转化为真实 Dom
33 实现模板字符串解析功能
34 实现一个对象的 flatten 方法
35 列表转成树形结构
36 树形结构转成列表
36 实现 reduce
37 实现 before 函数(AOP) ✔️
function fn (msg) {
console.log(msg);
}
Function.prototype.before = function(beforeFn) {
return (...args) => {
beforeFn();
this(...args); // 执行用户函数
}
}
let newFn = fn.before(() => {
console.log('do something before core fn');
});
newFn('正经事'); // do something before core fn 正经事儿