百度春招前端一面
介绍自己
怎么接触的前端,怎么学习的前端
实习项目相关,背景痛点,技术难点
执行流程题
var name = 'global';
function test(){
console.log(name);//undifined
var name = 'local';
}
test();
var name = "mary";
function hello() {
console.log(name);
}
function hello1() {
var name = "bob";
hello();
}
function hello2() {
var name = "john";
function hello(){
console.log(name);
}
hello();
}
hello(); // mary
hello1(); // mary
hello2(); // john
//浏览器环境
var a = 20;
function test() {
this.a = 10;
setTimeout(() => {
console.log(this.a);
setTimeout(function () {
var a = 30;
console.log(this.a);
}, 100);
}, 100);
}
test(); // 10 10
let func = new test();// 10 10
事件循环输出题
手写:可以控制层级的flat方法
查看14道真题和解析