当前位置: 首页 > 面试经验 >

滴滴提前批前端(用户增长,已gg)

优质
小牛编辑
52浏览
2024-08-08

滴滴提前批前端(用户增长,已gg)

三轮面试都在同一天
一面
● 自我介绍
● 项目经历
● React
● http1 vs http2
● vite
● webpack 的 loader 和 plugin 用途,如何开发 ❌
class MyPlugin {
apply(compiler) {
compiler.hooks.compile.tap('MyPlugin', (params) => {
console.log('The compiler is starting to compile...');
});
compiler.hooks.compilation.tap('MyPlugin', (compilation) => {
console.log('The compiler is starting a new compilation...');
compilation.hooks.optimize.tap('MyPlugin', () => {
console.log('The compilation is starting to optimize assets...');
});
});
}
}
● 防抖节流
● fiber
● 数组转树 ❌
二面
● 自我介绍
● 手写new ❌ 写了好几个读程序题 demo 提醒我,感动
○ 有reutrn 会覆盖 prototype
○ 通过bind将 this 指向 继承了prototype 的新对象
function _new(fn){
let obj = Object.creat(); // 继承
let ans = fn.call(obj,...args) // 求返回值,绑定this
return ans instanceOf Object ? ans : obj
}
● 读程序题 promise
● 异步编程
● 手写 race
● 手写对象扁平化
● webpack
○ plugin 运行时机 ❌
● 初始化阶段:
○ environment:在创建 compiler 环境之前。
○ afterEnvironment:在 compiler 环境创建完成之后。
● 配置阶段:
○ entryOption:在 webpack 选项的 entry 配置项处理过程中调用。
● 编译阶段:
○ beforeRun:在开始读取记录之前。
○ run:在开始读取记录之后,编译开始之前。
○ watchRun:在监听模式下,一个新的编译周期开始时。
○ beforeCompile:在创建compilation参数之后,执行编译之前。
○ compile:在一个新的compilation创建之前。
○ thisCompilation:在触发compilation事件之前执行。
○ compilation:在compilation创建之后执行。
● 构建模块阶段:
○ make:在完成编译之前。
○ afterCompile:在完成编译之后。
● 优化阶段:
○ shouldEmit:在输出 asset 之前调用。
○ emit:在输出 asset 到输出目录之前。
○ afterEmit:在输出 asset 到输出目录之后。
● 输出阶段:
○ assetEmitted:在 asset 被输出时。
● 完成阶段:
○ done:在 compilation 完成之后。
○ failed:在 compilation 失败时。
● 其他钩子:
○ watchClose:在监听模式停止时。
○ 为什么更慢 ,遍历所有文件
● React 的渲染原理 FIber
○ 箭头函数的原理,局限场景
○ diff 算法的具体内容、策略
● 监控白屏SDK 的思路
○ a) 检测时机:
■ 页面加载完成后(window.onload)
■ 或使用 MutationObserver 监听 DOM 变化
b) 检测方法:
■ 截图法:使用 html2canvas 等库对页面进行截图,分析像素是否全白
■ 元素检查法:检查页面上是否存在关键元素
■ 采样法:elementFromPoint() 在页面的不同位置取样点,检查这些点上的元素是否存在且可见。如果大部分采样点都没有有效元素,我们就可以认为页面可能是白屏
● 反问
● 业务+规模
三面
● 自我介绍
● 问的问题都是开发性的
● 为什么选择前端
● 如何学习的前端
● React 和 vue 的区别
● 前端的不同方向,设计的技术栈
● 你希望哪个方向
● to B 还是 to C
● 低代码的经历
● React 和 低代码有什么不同
● 获得abc全排列所有序列,分别回溯求 子串
● 求 得 abc 子串时 求子串的全排列
function generateAllCombinations(str) {
const chars = str.split('');
const result = new Set(); // 使用 Set 来避免重复
// 生成所有子集(组合)
function generateSubsets(start, current) {
if (current.length > 0) {
// 对当前子集生成所有排列
generatePermutations(current, 0);
}
for (let i = start; i < chars.length; i++) {
current.push(chars[i]);
generateSubsets(i + 1, current);
current.pop();
}
}
// 生成给定数组的所有排列
function generatePermutations(arr, start) {
if (start === arr.length - 1) {
result.add(arr.join(''));
return;
}
for (let i = start; i < arr.length; i++) {
[arr[start], arr[i]] = [arr[i], arr[start]]; // 交换
generatePermutations(arr, start + 1);
[arr[start], arr[i]] = [arr[i], arr[start]]; // 交换回来(回溯)
}
}
generateSubsets(0, []);
return Array.from(result);
}
// 测试
console.log(generateAllCombinations(&quot;abc&quot;));
一面手撕没写出来,不知道是不是我三面挂的原因~
#24届软开秋招面试经验大赏##第一次面试##我发现了面试通关密码##如何判断面试是否凉了##你的秋招进展怎么样了##滴滴#
 类似资料: