Skip to content

Instantly share code, notes, and snippets.

@oott123
Created Jul 25, 2015
Embed
What would you like to do?
Node.js Harmony
node --harmony test.js
p1 callback
p3 callback
this is p1
"use strict";
var p1 = new Promise((resolve, reject) => {
console.log("p1 callback");
resolve("this is p1");
});
var p2 = Promise.reject(2);
var p3 = new Promise((resolve, reject) => {
console.log("p3 callback");
resolve("this is p3");
});
var p4 = Promise.race([p1, p2, p3]);
p4
.then(
(value) => {
console.log(value);
},
(error) => {
console.log(error);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment