I understand Promises to exist in one of three states: A Promise can either be pending (unresolved), fulfilled (resolved successfully) or rejected (resolved unsuccessfully).
Reading through the A+ Promise Spec and MDN's documentation, I am confused that they both acknowledge the fulfilled and rejected states but in the definition of the Promise constructor they specify two callbacks: resolve and reject. It seems we're using these two terms interchangeably; they are not.
Does not imply success:
re·solve /r??z?lv/ verb
1. settle or find a solution to (a problem, dispute, or contentious matter).
Does imply success:
ful·fill /fo?ol?fil/ verb
1. bring to completion or reality; achieve or realize (something desired, promised, or predicted).
2. carry out (a task, duty, or role) as required, pledged, or expected.
Why are we using resolve here when we're actually fulfilling the Promise? Is there an instance in which the value we pass to resolve might result in the Promise being rejected?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…