js基础知识

闭包:闭包就是能够读取其他函数内部变量的函数。

this:this是Javascript语言的一个关键字。 它代表函数运行时,自动生成的一个内部对象,只能在函数内部使用,随着函数使用场合的不同,this的值会发生变化。但是有一个总的原则,那就是this指的是,调用函数的那个对象。(http://www.jb51.net/article/41656.htm)

promise

setTimeout:

setTimeout(function() {
      console.log(1)
    }, 0);
    new Promise(function executor(resolve) {
      console.log(2);
      for( var i=0 ; i<10000 ; i++ ) {
        i == 9999 && resolve();
      }
      console.log(3);
    }).then(function() {
      console.log(4);
    });
    console.log(5);
//23541
原文地址:https://www.cnblogs.com/lcyuhe/p/7069146.html