一、选择题:都是一些基础,
1.数组原型(arr.__proto__ === Array.prototype)
2.箭头函数有没有this啥的
3.哪些标识符是缓冲相关的(cache-control,etag)
4.v-for遍历,能否key做数组下标?vue2的动态数据是用es6的proxy?
5.哪些一定不会引起重排四个选项:visible,color,padding,boder
二、代码题(手写)
1.写样式,就是设置padding,剧中
2.使用Promise、async、await实现红绿灯切换,并在控制台打印输出,红灯:30s,黄灯5s,绿灯20s
class TrafficLightController { constructor () { this.duration = { green : 30, yellow : 3, red : 20 } this.isRunning = false } async start () { this.isRunning = true while (this.isRunning) { console.log('绿灯'); await this.light('gree', this.duration.green) console.log('黄灯'); await this.light('yellow', this.duration.yellow) console.log('红灯'); await this.light('red', this.duration.red) } } changeDuration (color, newDuration) { this.duration[color] = newDuration } async light (color, duration) { return new Promise((resolve, reject) => { setTimeout(resolve, duration * 1000); }) } stop () { this.isRunning = false; } } // 示例用法 const controller = new TrafficLightController(); controller.start(); setTimeout(() => { controller.stop() console.log('结束'); }, 10000);
总结:答得还行,就是不知道为啥挂了
#笔试面经##我的实习求职记录#