// 1: 根据后面的每次调用写出 o 的输出结果:
function fun(n, o) {
console.log(o);
return {
n: 10,
fun: function (m) {
return fun(m, n);
}
};
}
var a = fun(0);
a.fun(1); //
a.fun(2); //
a.fun(3); //
console.log(a);
// 2. 请写出 console.log 的结果,若异常请写出原因
function foo(a) {
var fn = 12;
fn();
function fn(num) {
console.log(num += a);
}
}
foo(10);
// fn
// 3. 写出以下代码在标准浏览器的输出顺序
async function async1() {
console.log(1);
await async2();
console.log(2);
}
async function async2() {
console.log(3)
}
console.log(4)
setTimeout(function () {
console.log(5)
}, 0);
async1();
new Promise(function (resolve) {
console.log(6);
resolve();
}).then(function () {
console.log(7)
})
console.log(8);
一次有价值的面试题【前端】
最新推荐文章于 2024-08-09 10:42:44 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)