前端面试题-字节跳动一面

  1. HTTPS和HTTP区别
  2. HTTPS 连接建立的过程
  3. CDN 有哪些优化静态资源加载速度的机制?
  4. 有哪些方式实现 HTTP 请求浏览器缓存?ETag是如何生成的?
  5. 谈下Promise.race和Promise.all
  6. 写出一下代码console输出顺序
async function async1() {
     
  console.log('async1 start');
  await async2();
  console.log('async1 end');
}

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

console.log('script start');

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

async1();

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

console.log('script end');

7.请补充完成逻辑

   function sum(num) {
     
       // 请你实现
   }
   
   const a = sum() // a === 0
   const b = sum(6)() // b === 6
   const c = sum(4)(5)() // c === 9
   const d = sum(1)(1)(1)() // d === 3
   ...
   const k = sum(n1)...(nk)() // n1 + ... + nk

8.请输出二叉树的每个左节点

       1
      / \
     3   5
        / \
       4   6
       
    输出 [1, 3, 4]
    function TreeNode(val) {
     
        this.val = val;
        this.left = null;
        this.right = null;
    }
    
    function leftView(root) {
     
      // 请你实现
    }
  1. React Fiber 架构?
  2. React UNSAFE_ ?
  3. react生命周期函数
  4. react 自定义 hooks如何使用,需要注意什么?

你可能感兴趣的:(技术博客,javascript,reactjs)