• 前端工程师面试题JavaScript部分(第二季)


    哪个公司出的题就表了,关键看题,和alert(1&&2)这种怪题比起来,相对接地气一点

    !!(0==false)
    //!!一般是用来转为布尔值的,0为false,false==false所有结果是true
    !!(0==undefined)
    //结果是true,js is shit
    undefined==null
    //结果是true ,标准就是这么规定的
    isNaN('1213')==NaN
    //判断是否非数字,false ==NaN,这里console.log(!!NaN)是false,shit
    typeof 1 == true?1:0
    //number== true 为false,取0,注意运算符的优先级
    typeof [] == 'Array'//false, typeof [] == 'object'
    [] instanceOf Array
    //这个没啥好说的,

    jquery的bind类似的绑定方法,live,on,delegate等方法,和语法糖的区别,另外实现bind函数、delegate函数

     首先从下面的题来看this问题

    var altwrite = document.wirte;
    altwrite('hello');
    //传递的this错误,需要bind,编译错误
    altwrite.bind(document)('hello');
    //这里出现一个innerHTML和document.write的区别,或者
    altwrite.call(document,'hello');

    实现一个bind方法来传递this作用域参数

    //

    //函数.bind(上下文参数,普通参数1,。。。);
    var dom = document.getElementById('ad');
    dom.onclick = (function(){
        console.log(this)//输出是window
    }).bind(this)

    垂直居中的对中情况

    布局的多种问题

    IE6的常见hack、盒子模型

    事件对象的问题,还有兼容性问题

    实现一个集成,函数定义的位置

  • 相关阅读:
    如何配置android的adb环境变量
    react中 如何异步展示后台接口的提示消息
    java doc 相关
    linux 停止多个 进程...
    maven 打包 war 包含 WEB-INF/lib 目录
    对 ArrayList 进行分页.
    docker 磁盘清理 相关
    vue 在 html 中自定义 tag
    docker 限制 容器内存 使用
    mysql 基本语句
  • 原文地址:https://www.cnblogs.com/wgdong/p/5267334.html
Copyright © 2020-2023  润新知