小米-前端-一二面面经

1.16:9的盒子怎么实现(等比例)
2.px em rem 区别
3.    1 + null = ?
1 + undefined = ?
1 + “1” = ?
“11” > “2” = ?
4.  实现Array.map

Array.prototype.mymap = function(fn) {

    let ans = [];

    for(let i = 0; i< this.length; i++) {

        ans[i] = fn(this[i],i,this);

    }

    return ans;

}


5. span是什么元素?可以设置宽高吗?可以设置marigin/padding吗?
6. BFC如何触发?display:block可以触发吗?display:flex可以触发吗?
7. flex-basis?flex-grow?flex-shrink?
8. 单行省略号?多行省略号呢?
9. transform有哪些属性?书写前后顺序会有影响吗?
10. 输出顺序
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');

11. HTTP 301 302 304 405 401
12. 判断输出


class Example extends React.Component {

  constructor() {

    super();

    this.state = {

      val: 0

    };

  }



  componentDidMount() {

    this.setState({val: this.state.val + 1});

    console.log(this.state.val);    // 第 1 次 log



    this.setState({val: this.state.val + 1});

    console.log(this.state.val);    // 第 2 次 log



    setTimeout(() => {

      this.setState({val: this.state.val + 1});

      console.log(this.state.val);  // 第 3 次 log



      this.setState({val: this.state.val + 1});

      console.log(this.state.val);  // 第 4 次 log

    }, 0);

  }



  render() {

    return null;

  }

};


13. React Hooks的capture value特性是什么?


二面

1.react hooks的原理

2.keep-alive的实现原理

3.opacity改变会导致重排和重绘吗

4.在书写html时,是先写css还是js

4.src属性和href属性的区别

5.为什么要区分引用传递和值传递

6.闭包和堆栈?JS基本数据类型和引用类型都存在什么地方?是绝对的吗?闭包就是特殊情况

7.定位有哪些 absolute定位相对于什么定位?


#面经##校招##小米##前端工程师#
全部评论
楼主你好,请问你是实习、校招还是社招?
点赞 回复
分享
发布于 2020-09-22 16:44
请问你的是女面试官吗
点赞 回复
分享
发布于 2020-09-22 18:34
滴滴
校招火热招聘中
官网直投
笔试有算法题吗
点赞 回复
分享
发布于 2020-09-23 14:38

相关推荐

1 12 评论
分享
牛客网
牛客企业服务