JavaScript Promises: There and back again