js笔试题

  1. 那个是正确的

    1.for (let index = 0; index < 12; index++) {};console.log(index);//错误
    2.const a = 12;a = 13;console.log(a);//错误
    3.const G = {a:3};console.log(G.a);G.b=12;console.log(G.b);// 3,12
    4.let [head,...tail] = [1,2,3,4];console.log(tail)// [2,3,4]
  2. 请问输出的是 // GoodByeJack

    var name = 'world';
    (function () {
     var name;
     if (typeof name === "undefined") {
         name = 'Jack';
         console.log('GoodBye'+name)
     } else {
         console.log('hello'+name)
     }
    })();

你可能感兴趣的:(前端)