In JavaScript, a Promise is a one-way door that becomes permanently settled and locked the moment resolve or reject is called; any subsequent calls to resolve or reject are completely ignored, meaning only the first resolve or reject determines the final state of the Promise.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Calling resolve and reject Methods Inside a Promise | Can You Guess the Output?Added:
All right, can you guess the output of this code?
Drop your answer in the comments and let's see what happens here. First, we create a new promise and inside the executor function, we call resolve with first, then reject with error, then resolve again with second, three calls in a row. Then we chain a then and a catch to handle the result. Keep in mind that a promise is a one-way door. The moment you call resolve or reject, the promise is settled and its state is permanently locked. It can never be changed again. So, the first resolve with first settles the promise immediately. The reject and the second resolve that come after it are completely ignored by JavaScript. As a result, the output is first. If you want to master JavaScript concepts like this easily, my ebook is linked in bio.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 viewsβ’2026-05-28
How agent o11y differs from traditional o11y β Phil Hetzel, Braintrust
aiDotEngineer
450 viewsβ’2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanationπ―β
LearnwithSahera
1K viewsβ’2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 viewsβ’2026-05-29
Search Algorithms Explained in 60 Seconds! π€π¨
samarthtuliofficial
218 viewsβ’2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 viewsβ’2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 viewsβ’2026-05-29
So What's Odin Lang Even Good For
TechOverTea
131 viewsβ’2026-06-01











