Whenever you see someFunction(...).then(...)
(And may be followed with .catch(...)
To handle errors)
That means:
someFunction
returns aPromise
then(...)
handles the promise once it is fulfilled (orresolve
d)catch(...)
handles the error (if one occurs during the promise) (e.g. when it isreject
ed)