百度一面

时间 2026_0228-19:00_百度(1h)
1. 自我介绍
2. 代码输出题

---
🅐 aaa - bbb 垂直高度计算
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      p {
        font-size: 16px;
        line-height: 1;
        margin-top: 10px;
        margin-bottom: 15px;
      }
    </style>
  </head>
  <body>
    <p>aaa</p>
    <p></p>
    <p></p>
    <p></p>
    <p>bbb</p>
  </body>
</html>

---
🅑 对象方法 + this 指向
const obj = {
  fn1() {
    const fn = () => {
      console.log(this);
    };
    fn();
    fn.apply(window);
  },

  fn2() {
    function fn() {
      console.log(this);
    }
    fn();
    fn.apply(window);
  },
};

obj.fn1();
obj.fn2();

---
🅒 Promise + setTimeout 执行顺序
new Promise((res, rej) => {
  console.log(1);
  setTimeout(() => {
    console.log(2);
    res("success");
    console.log(3);
  }, 0);
}).then((res) => console.log(res));

console.log(4);

---
🅓 作用域链
const a = 10;

function fn() {
  const a = 20;
  test();
}

function test() {
  console.log(a);
}

fn();

---
3. 第一道题结束问到是否了解BFC
4. 讲一下事件循环
5. 浏览器输入url发生了什么
6. 讲讲回流和重绘
7. 讲一下闭包
8. 选一个自己项目中遇到的难题,怎么解决的讲一下
9. 为什么项目要使用SSR?
10. 平时怎么使用AI
11. 怎么理解rules?
12. 写一个类似于百度搜索页的页面(要求实现分页),共享屏幕(新建a.html的时候面试官说起一个工程来写,然后问可以用AI吗,面试官说什么都可以用,然后我打开了Gemini...)

13. 新建工程的时候用了pnpm,问到为什么选择使用pnpm(提到幻影依赖)
14. 产生幻影依赖的原理知道吗?
15. 手撕:反转链表
16. 反问了一些学习建议,说看一下掘金里面大佬分享的文章
全部评论

相关推荐

评论
2
2
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务