Skip to content

Commit

Permalink
Added more helpful technique for accessing promise (#1124)
Browse files Browse the repository at this point in the history
* Added more helpful technique for accessing promise

* Updated w/ feedback

* Add missing semicolon
  • Loading branch information
justsml authored and wbamberg committed Sep 13, 2018
1 parent 49a0abc commit 541dafc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion live-examples/js-examples/promise/promise-constructor.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
<pre>
<code id="static-js">var promise1 = new Promise(function(resolve, reject) {
setTimeout(resolve, 100, 'foo');
setTimeout(function() {
resolve('foo');
}, 300);
});

promise1.then(function(value) {
console.log(value);
// expected output: "foo"
});

console.log(promise1);
// expected output: [object Promise]

</code>
</pre>

0 comments on commit 541dafc

Please sign in to comment.