zoukankan      html  css  js  c++  java
  • 前端工程师面试题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、盒子模型

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

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

  • 相关阅读:
    内核中的内存都不分页
    SQL Server 变更数据捕获(CDC)
    FPGA视频拼接器的放大和缩小功能
    Button的Click事件与js函数的两种不同顺序触发方式
    STM32系列ARM单片机介绍
    开源ETL工具kettle--数据迁移
    hdu 2846 Repository
    LeetCode 231:Power of Two
    hdu 4628 Pieces(状态压缩+记忆化搜索)
    MongoDB 数据库下载和安装
  • 原文地址:https://www.cnblogs.com/wgdong/p/5267334.html
Copyright © 2011-2022 走看看