var p = new Parallel([0, 1, 2, 3, 4, 5, 6]);
p.map(nthPrime)
.then(function (resultArr) {
console.log(resultArr);
});
//logs a new array with nth prime numbers as elements
WorkWork.map(function (elem, i) {
return nthPrime(elem);
})
.then(function (resultArr) {
console.log(resultArr);
})
//logs a new array with nth prime numbers as elements
Method | Time (ms) |
---|---|
Parallel | |
WorkWork |