您现在的位置:首页 >> 前端 >> 内容

腾讯前端面试题

时间:2017/4/15 9:58:00 点击:

  核心提示:腾讯前端面试题:2017年4月13日 10:30 面试,下午7点得到复试通知,面试结束后回忆内容,程序具体细节可能有出入,但题目核心内容应该没错。1. 写出以下程序的输出var test ={foo:...

腾讯前端面试题:2017年4月13日 10:30 面试,下午7点得到复试通知,面试结束后回忆内容,程序具体细节可能有出入,但题目核心内容应该没错。

1. 写出以下程序的输出

var test =  {
  foo: "test",
  a: function() {
    var self = this;
    console.log(this.foo);
    console.log(self.foo);

    (function() {
      console.log(this.foo);
      console.log(self.foo);
    })();
  }
}

test.a();

2. 以下程序输出

console.log(1);
setTimeout(function() {
  console.log(2);
}, 1000);
setTimeout(function() {
  console.log(3);
}, 0);
console.log(4);

3. 点击button后,发生什么

for (var i = 0; i < 5; i++) {
  var button = document.createElement("button");
  button.innerHTML="click";
  document.body.appendChild(button);
  button.onclick = function() {
    alert(i);
  }
}

4. 下列程序输出

考察 split(), join(), slice(), reverse()等函数的使用

作者:网络 来源:bedisdover