There are only two hard things in Computer Science: cache invalidation and naming thing...
There are only two hard things in Computer Science: cache invalidation and naming thing...
新增加的组件 表单元素和Vuex c-accordion 新使用的第三方组件 portal-vue vue-virtual-scroller preload-webpack-...
console.log('golb1');
setTimeout(function() {
console.log('timeout1');
new Promise(function(resolve) {
console.log('timeout1_promise');
resolve();
}).then(function() {
console.log('timeout1_then')
})
})
new Promise(function(resolve) {
console.log('glob1_promise');
resolve();
}).then(function() {
console.log('glob1_then')
})
setTimeout(function() {
console.log('timeout2');
new Promise(function(resolve) {
console.log('timeout2_promise');
resolve();
}).then(function() {
console.log('timeout2_then')
})
})
new Promise(function(resolve) {
console.log('glob2_promise');
resolve();
}).then(function() {
console.log('glob2_then')
})
对于这段代码,浏览器和node 的执行结果不一致,
浏览器的结果是:
timeout1->timeout1_promise->timeout1_then->timeout2->timeout2_promise->timeout2_then
而node结果是:
timeout1->timeout1_promise->timeout2->timeout2_promise->timeout1_then->timeout2_then
请问这是什么原因呢
前端基础进阶(十四):深入核心,详解事件循环机制JavaScript的学习零散而庞杂,很多时候我们学到了一些东西,但是却没办法感受到进步!甚至过了不久,就把学到的东西给忘了。为了解决自己的这个困扰,在学习的过程中,我一直在...
JavaScript的学习零散而庞杂,很多时候我们学到了一些东西,但是却没办法感受到进步!甚至过了不久,就把学到的东西给忘了。为了解决自己的这个困扰,在学习的过程中,我一直在...