zoukankan      html  css  js  c++  java
  • 数美(sm)面经

    1、

    console.log(1 && 0)
    console.log(0 && 1)

    2、

    window.val = 1;
    var json = {
        val: 10,
        dbl: function(){
            this.val *= 2;  
      }
    };
    json.dbl();
    var dbl = json.dbl;
    dbl();
    json.dbl.call(window);
    alert(window.val + json.val);

    3、

    var name = 'Shumei';
    (function(){
        if(typeof  name === 'undefined'){
             var name = 'SM';
             console.log('Hello' + name);
        } else {
             console.log('Hello' + name);
        } 
    }) ();

    4、

    function Test(name, age){
        this.name = name;
        if(age!= undefined){
              this.age = age;
    ​
        }
    }
    ​
    Test.prototype = {
        name: "SM",
        age: 18
    };
    ​
    var instance = new Test();
    console.log(instance.name);
    console.log(instance.age);
    console.log(instance.constructor);

    5、

    console.log(null == undefined)
    console.log(Boolean("false"))
    console.log({} == 0)
    console.log([] == 0)

    6、

    var a1 = [1,2];
    var a2 = a1;
    a1[0] = a2[1];
    a2.push(3);
    
    console.log(a1);
    console.log(a2);

    7、

    setTimeout(function(){
       console.log(1)
    }, 0);
    
    new Promise(function(resolve, reject){
        var i = 0;
        console.log(2);
        while(i<100){
             i ++ ;
             i == 1 && resolve();
        }
        console.log(3);
    }).then(function(){
        console.log(4)
    });
    
    console.log(5);
  • 相关阅读:
    小点
    三.一些常用类
    字符串相关:String,StringBuffer,StringBuilder
    五.二叉树
    四.递归
    三.队列
    二.栈
    一.数组,链表
    RDLC 矩阵图片列表排列顺序乱
    RDLC 矩阵每隔一页就有空白页 矩阵 空白页
  • 原文地址:https://www.cnblogs.com/nini123123/p/12770045.html
Copyright © 2011-2022 走看看