Promise3 icon indicating copy to clipboard operation
Promise3 copied to clipboard

added commented and fix bug

Open nzhl opened this issue 6 years ago • 0 comments

以下代码在你之前的commit 中会正确打印出A, B 和浏览器行为符合 但是最新的一次commit之后不能正确打印A, B。 我已经对这个问题进行了修复。

另一方面, 我看了你那篇解析文章之后, 给你的代码加入了大量注释, 文件名为 promise.js。

这次 pr 主要是希望能帮助到更多人, 谢谢。

var p3 = new Promise( function(resolve,reject){
	resolve( "B" );
} );

var p1 = new Promise( function(resolve,reject){
	resolve( p3 );
} );

var p2 = new Promise( function(resolve,reject){
	resolve( "A" );
} );

p1.then( function(v){
	console.log( v );
} );

p2.then( function(v){
	console.log( v );
} );

// A B  <-- 不是你可能期望的 B A

nzhl avatar Jan 20 '19 16:01 nzhl