Interview
Interview copied to clipboard
【04-26】😋 W公司
! 10-10-5 工作制
笔试题 30分钟
- 问输出什么
var name = 1
var obj = {
name: 2,
prop: {
name: 3,
getName: function () {
setTimeout(function showName () {
console.log(this.name)
}, 1000)
return this.name
}
}
}
console.log(obj.prop.getName())
var getName = obj.prop.getName
console.log(getName())
- ~问输出什么~
(function () {
console.log(1)
setTimeout(() => console.log(2), 1000)
setTimeout(() => console.log(3), 0)
console.log(4)
})();
- ~没啥技术含量, 就一个
Promise.all
的应用, 懒得写了~ - ~手写一个深拷贝~
- ~实现add函数, 如:
add(1)(2);
add(1, 2)(3)
~
一面 35分钟
- ~说一下vue的生命周期, 在不同阶段vue做了哪些事~
- ~有用过vue3吗, 说一下vue3做了哪写优化~
- ~项目中vuex用的多吗, 为什么要使用vuex呢~
- ~vue-router原理说一下~
- ~vue组件之间的通信方式~
- ~webpack用到的多吗~
- ~平时项目中有对项目做过哪些优化吗~
- 项目中有做过线上错误日志收集之类的吗
- ~说一下跨域, 为什么会出现跨域呢, 跨域请求是否可以被服务端接收到~
- ~
call
/apply
/bind
之间有什么不同, 手写一个bind
方法~ - ~原型和原型链介绍一下~
- ~手写实现
(2).add(4)
得到6,(1).add(2)
得到3~ - 问输出什么
Promise.resolve('foo')
.then(Promise.resolve('bar'))
.then(res => console.log(res))
- ~问输出什么~
console.log(1)
let p = new Promise(resolve => {
console.log(2)
resolve()
console.log(3)
})
async function fn () {
console.log(4)
await p.then(() => console.log(6))
console.log(7)
}
fn()
setTimeout(() => console.log(8))
console.log(5)
- ~实现一个
sleep(1000)
函数~ - CMD和UMD的区别是什么
- ~在项目中开发过一些UI组件吗~
- vue路由中的按需加载用过吗, 内部实现原理了解吗
二面 30分钟
- ~开源项目的设计思路和相关API~
- ~ts里面的
type
和interface
有什么区别~ - ~问了点this指向的相关问题~
- ~平时一般会通过什么方式去自学~
- ~问输出什么~
setTimeout(() => console.log(1))
new Promise(resolve => {
resolve()
console.log(2)
}).then(() => console.log(3))
console.log(4)
- ~
setTimeout
和setInterval
区别,setInterval
会有哪些问题~ - 写过webpack插件吗
- ~这个小程序有没有去了解过他的原理~
- ~设计模式了解吗, 发布订阅模式可以写个伪代码吗~
- ~
Map
和WeakMap
之间有什么区别~ - ~关于js在浏览器运行时阶段, V8引擎做过哪方面的优化~
- ~说一下http常见的状态码~
- ~近几年个人规划和职业规划是什么~
三面 [远程] 37分钟
- ~贡献屏幕, 解一道题~
// 假设本地机器无法做加减乘除法,需要通过远程请求让服务端来实现。
// 以加法为例,现有远程API的模拟实现
const addRemote = async (a, b) => new Promise(resolve => {
setTimeout(() => resolve(a + b), 1000)
})
// 请实现本地的add方法,调用addRemote,能最优的实现输入数字的加法。
async function add(...inputs) {
// 你的实现
}
// 请用示例验证运行结果:
add(1, 2).then(result => console.log(result)) // 3
add(3, 5, 2).then(result => console.log(result)) // 10
- ~介绍一下你的项目~
- ~说一下async/await底层是如何实现的~, 可以手写吗
- 那你说一下babel的编译原理
- AST抽象语法树你了解多少
- ~你们是如何搭建的项目 (cli脚手架)~
- 你开发过cli的脚手架工具吗
- ~webpack你使用过哪些配置~
- ~webpack的devServer底层是如何实现跨域的~
- ~什么情况下会出现跨域~
- 如果是后端去调用其他接口, 会触发跨域吗
- webpack的
Tree-shaking
是如何实现按需加载的 - webpack里面的hash有多少种
- 那contenthash和chunkhash都有什么区别
- ~webpack的hash有什么作用~
- 浏览器什么情况下会对资源进行缓存
- 你一般会如何设置浏览器缓存, 详细说一些配置参数
- 304这个状态码, 除了命中协商缓存, 还会有别的情况吗
- ~http状态码, 301和302之间有什么区别, 何时会发生缓存~
- ~如果是http跳转https, 你会选择哪种重定向~
- ~vue3使用过吗, vue3和vue2有哪些主要的区别, vue3新特性~
- 使用过版本号自动管理, 自动发布流程吗
- ~为什么会想要跳槽离职呢~
- ~你还有什么想问的吗~
四面 [远程] 20分钟
- 换了个部门就简单聊了聊, 没问技术, 就瞎聊
E轮融资, 马上上市, 但是最高只能给到(n)k*14薪, 可惜了
早上10点到晚上10点, 虽然是双休, 但是感觉业余学习时间就不剩什么了