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 的執(zhí)行結(jié)果不一致果录,
瀏覽器的結(jié)果是:
timeout1->timeout1_promise->timeout1_then->timeout2->timeout2_promise->timeout2_then
而node結(jié)果是:
timeout1->timeout1_promise->timeout2->timeout2_promise->timeout1_then->timeout2_then
請問這是什么原因呢
前端基礎(chǔ)進階(十四):深入核心,詳解事件循環(huán)機制JavaScript的學(xué)習(xí)零散而龐雜妨马,很多時候我們學(xué)到了一些東西挺举,但是卻沒辦法感受到進步!甚至過了不久烘跺,就把學(xué)到的東西給忘了湘纵。為了解決自己的這個困擾,在學(xué)習(xí)的過程中滤淳,我一直在...
JavaScript的學(xué)習(xí)零散而龐雜,很多時候我們學(xué)到了一些東西脖咐,但是卻沒辦法感受到進步铺敌!甚至過了不久,就把學(xué)到的東西給忘了屁擅。為了解決自己的這個困擾偿凭,在學(xué)習(xí)的過程中,我一直在...