In the code above, _get() does not return a value, instead it takes a function as a parameter, to which it will pass the value when it is available.

Promises are a programming pattern where asynchronous functions do return something: a Promise object. A Promise represents a future value, that will be available later. In my lightweight implementation, a Promise has two methods:

.then(function(value, error))

Attach a function that will be invoked when the value is available.

.done(value, error)

Set the value.

(The error parameter allows to propagate an error code. You can leave it undefined if everything went OK.)