Why does Promise not have a get() function?

Viewed 2852

If you know that the Promise has already been resolved why can't you just call get() on it and receive the value? As opposed to using then(..) with a callback function.

So instead of doing:

promise.then(function(value) {
  // do something with value
});

I want to be able to do the much simpler:

var value = promise.get();

Java offers this for it's CompletableFuture and I see no reason why JavaScript couldn't offer the same.

2 Answers
Related