2021大厂面试题(一)

1.写React / Vue 项目时为什么要在列表组件中写key, 其作用是什么?

2.['1','2','3'].map(parseInt) what & why ?

3.什么是防抖和节流?有什么区别?如何实现?

4.介绍下Set、Map、WeakSet、和WeakMap的区别?

5.介绍下深度优先遍历和广度优先遍历,如何实现?

6.请分别用深度优先和广度优先思想实现一个拷贝函数?

7.ES5 / ES6 的继承除了写法以外还有什么区别?

8.setTimeout、Promise、Async / Await 的区别

9.Async / Await 如何通过同步的方式实现异步

10.异步笔试题请写出下面代码的运行结果

async function async1() {
    console.log('async1 start')
    await async2()
    console.log('async1 end')
}

async function async2() {
    console.log('async2')
}

console.log('script start')

setTimeout(() => {
    console.log('setTimeout')
}, 0);

async1();

new Promise(function(resolve) {
    console.log('promise1');
    resolve()
}).then(function() {
    console.log('promise2');
})

console.log('script end')
posted @ 2021-12-05 09:20  只做你的向日葵  阅读(39)  评论(0编辑  收藏  举报