Skip to content

Latest commit

 

History

History
40 lines (23 loc) · 1.41 KB

File metadata and controls

40 lines (23 loc) · 1.41 KB

No resolve or reject in the promise constructor the .then is not ran. Same as the .catch, .finally.

why? These methods are invoked by either a resolve or a reject.

Resolve promise

resolve is called in the Promise constructor which makes the .then and the .finally to run. Also the internal properties Result and State are changed.

  • Result is given the value passed into the resolve function.
  • State is given the value fulfilled

Resolved promise

Rejected promise

reject is called instead of resolve, the .then and .catch is executed but the html reports uncaught in promise error

Rejected promise

Actuallity

resolve

takes an argument and returns it when the .then is called. ie. the resolve calls the .then and gives it the values passed into the resolve If the value passed in the resolve is a function the function is returned, if the value is any value, character, string then it is passed into the .then

By so, the .then can have a function to handle the passed value or run the passed function.

Resolve returns any thing passed to it

Function passed is returned.

Run a returned function

Function passed call be executed in the .then

String passed

A string is easily received.