前端面试题目
1 如何将arguments转化为真正的数组?
2 写出以下代码打印结果
if([]==false){console.log(1);}; //1
if({}==false){console.log(2);}; //undefined
if([]){console.log(3);}; //3
if([1]==[1]){console.log(4);}; //undefined
3 写出以下代码打印结果
async function async1(){
console.log("async1 start");
await async2();
console.log("async1 end");
}
async function async2(){
console.log("async2");
}
console.log("script start");
setTimeout(function(){
console.log("setTimeout");
},0);
async1();
new Promise(function(resolve){
console.log("promise1");
resolve();
}).then(function(){
console.log("promise2");
});
console.log("script end");
参考链接:
https://www.zhihu.com/question/27981152
posted on 2017-09-19 09:02 pavilion2t 阅读(181) 评论(0) 收藏 举报
浙公网安备 33010602011771号