【面经】字节前端开发工程师一面代码题面经

1. 作用域

let value = 1;
function foo() {
console.log(value);
}
function bar() {
let value = 2;
foo();
}
bar() //1

2.this指向

window.name = 'ByteDance';
function A () {
    this.name = 123;
}
A.prototype.getA = function () {
    return this.name + 1;
};
let a = new A();
let funcA = a.getA;
console.log(funcA());//ByteDance1
console.log(a.getA());//124


3.this指向

const obj = {
    birth: 1990,
    getAge: function (year) {
        let fn = y => y - this.birth;
        return fn.call({ birth: 2000 }, year);
    }
};
console.log(obj.getAge(2020));

***循环

async function async1() {
    console.log('async1 start'); //2
    await async2();
    console.log('async1 end'); //6
async function async2() {
    console.log('async2'); //3
    }
}

console.log('script start'); // 1

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

async1(); 

new Promise(function (resolve) {
    console.log('promise1'); //4
    resolve();
}).then(function () {
    console.log('promise2'); //7
});
console.log('script end'); //5

5.用两个栈模拟队列

6.实现一个 function sqrt(x) {} 函数。计算并返回 x 的平方根,其中 x 是非负整数。



#字节跳动前端面经##面经##字节跳动#
全部评论
都是手写题,没问基础知识和项目吗
1 回复 分享
发布于 2022-03-02 16:46
有笔试吗
点赞 回复 分享
发布于 2022-03-19 09:53
楼主面的什么部门?
点赞 回复 分享
发布于 2022-03-18 14:34
是校招还是社招
点赞 回复 分享
发布于 2022-03-02 17:53

相关推荐

06-15 02:05
已编辑
南昌航空大学 数据分析师
Eason三木:你如果想干技术岗,那几个发公众号合唱比赛的经历就去掉,优秀团员去掉,求职没用。然后CET4这种不是奖项,是技能,放到下面的专业技能里或者单独列一个英语能力。 另外好好改改你的排版,首行缩进完全没有必要,行间距好好调调,别让字和标题背景黏在一起,你下面说能做高质量PPT你得展现出来啊,你这简历排版我用PPT做的都能比你做的好。 然后自我评价,你如果要干数据工程师,抗压能力强最起码得有吧。
简历中的项目经历要怎么写
点赞 评论 收藏
分享
大飞的诡术妖姬:之前看b站多明海有个说法,日本就业竞争非常低的原因不光是毕业学生少,还有很多人干两年不喜欢职场氛围就辞职躺平,位置也空了很多,论吃苦耐劳还得看咱们
点赞 评论 收藏
分享
评论
3
59
分享

创作者周榜

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