小米前端暑假实习一面凉经

和前面看到的一个面经是一模一样的,后悔没有仔细看,全是代码题
面试时间:4 月 1 日 移动终端部

1. 下面这些题目输出是什么?

1.1

```
(function(){
return typeof arguments;
})();
```

1.2

```
var foo = {
bar: function() { return this.baz; },
baz: 1
};

(function(){
return typeof arguments[0]();
})(foo.bar);

```

1.3

```
console.log([] == ![])
console.log( Function instanceof Object );
console.log( Object instanceof Function );
console.log( (function f(){}).__proto__ === Function.prototype);

```

1.4

```
function f(){ return f; }

consolelog(new f() instanceof f);
```

1.5

```
function foo(){
this.a = 100;
this.b = 200;
}

function goo(){
this.c = 300;
this.d = 400;
}

var seed = new foo();  //1

foo.prototype.fuss = function(fn) {
fn.prototype = seed;
seed = new fn;   //2
return this;     //3
}

var a = seed.fuss(goo);

console.log(a.c);
console.log(a === seed );
console.log(seed.a);
```

1.6

```
function foo(){
this.a = 100;
this.b = 200;
}

function goo(){
this.c = 300;
this.d = 400;
}

var seed = new foo();  //1

foo.prototype.fuss2 = function(fn) {
fn.prototype = seed;
return new fn;
}

var a = seed.fuss2(goo);

if ( "fuss2" in a ) {
var b = a.fuss2(foo);
}

console.log(Object.prototype.hasOwnProperty.call(a, "a"));
console.log("b" in a);
console.log("fuss2" in a);
console.log("c" in b);

```

1.7

```
const parent = function() {
const result = [];
const child = () => {
for (let num of arguments) {
result.push(num);
}
return result;
}

return child(1, 2, 3);
}

const result = parent(4, 5, 6, 7);
console.log(JSON.stringify(result));
```

1.8

```
var target = function() { return "I am the target"; };
var handler = {
apply: function(receiver, ...args) {
return "I am the proxy";
}
};

var p = new Proxy(target, handler);

console.log(p() === "I am the proxy");


2 . 实现一个Promise.all函数

Promise.all = function(arr) {

};

3. 给定后序遍历和中序遍历顺序构造二叉树

#小米##实习##前端工程师##面经#
全部评论
您是4.1投的吗
点赞 回复 分享
发布于 2021-04-17 14:16
暑期实习就是投的那个日常实习吗,还想问下楼主到岗日期写的什么时候啊
点赞 回复 分享
发布于 2021-04-23 09:53
这不就是我发的嘛🤣
点赞 回复 分享
发布于 2021-04-26 20:54

相关推荐

我即大橘:耐泡王
点赞 评论 收藏
分享
1 40 评论
分享
牛客网
牛客企业服务