Riunshow / NoteBook

人生不如意事十之九八,可与人言者并无二三
3 stars 0 forks source link

宇宙条电面 #19

Open Riunshow opened 4 years ago

Riunshow commented 4 years ago

1. 箭头函数与普通函数区别?能不能作为构造函数?

2. EventLoop 相关,有哪些宏任务和微任务?特点?

3. 对 requestAnimationFrame 的理解?

4. package.json 中的 peerDependencies?

5. 虚拟DOM的好处?

6. HTTPS是对称加密还是非对称加密?

7. webpack中loaders作用?plugins和loaders区别?### 8. 是否写过webpack插件?

9. 有没有用过单元测试?

10. 编程题:compose实现。

const add = num => num  + 10
const multiply = num => num * 2
const foo = compose(multiply, add)
foo(5) => 30
export default function compose(...funcs) {
  if (funcs.length === 0) {
    return arg => arg
  }
  if (funcs.length === 1) {
    return funcs[0]
  }
  return funcs.reduce((a, b) => (...args) => a(b(...args)))
}

redux中实现的compose

setsunadoudou commented 4 years ago

nice~~~~