osama-raddad
6/7/2017 - 11:00 AM

JS Bin // source https://jsbin.com/ziricer

JS Bin

// source https://jsbin.com/ziricer

new Promise(function(resolve, reject) { 
	// A mock async action using setTimeout
	setTimeout(function() { resolve(10); }, 3000);
})
.then(function(num) { console.log('first then: '+ num); return num * 2; })
.then(function(num) { console.log('second then: '+ num); return num * 2; })
.then(function(num) { console.log('last then: '+ num);});
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/1.2.2/bluebird.js"></script>
 
  <title>JS Bin</title>
</head>
<body>

<script id="jsbin-javascript">
new Promise(function(resolve, reject) { 
	// A mock async action using setTimeout
	setTimeout(function() { resolve(10); }, 3000);
})
.then(function(num) { console.log('first then: '+ num); return num * 2; })
.then(function(num) { console.log('second then: '+ num); return num * 2; })
.then(function(num) { console.log('last then: '+ num);});
</script>



<script id="jsbin-source-javascript" type="text/javascript">new Promise(function(resolve, reject) { 
	// A mock async action using setTimeout
	setTimeout(function() { resolve(10); }, 3000);
})
.then(function(num) { console.log('first then: '+ num); return num * 2; })
.then(function(num) { console.log('second then: '+ num); return num * 2; })
.then(function(num) { console.log('last then: '+ num);});</script></body>
</html>