首页 > 小米前端暑假实习一面凉经
头像
Jason_liang
发布于 2021-04-17 11:32
+ 关注

小米前端暑假实习一面凉经 内部员工回复

和前面看到的一个面经是一模一样的,后悔没有仔细看,全是代码题
面试时间: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. 给定后序遍历和中序遍历顺序构造二叉树

更多模拟面试

全部评论

(3) 回帖
加载中...
话题 回帖

相关热帖

历年真题 真题热练榜 24小时
技术(软件)/信息技术类
查看全部

热门推荐