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.
Inmersión profunda
Prerrequisito
- No hay datos disponibles.
Próximos pasos
- No hay datos disponibles.
Inmersión profunda
Calling resolve and reject Methods Inside a Promise | Can You Guess the Output?Añadido:
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.
Videos Relacionados
resume fixed instantly 😭 Comment “app”andI’ll sendyou the link #parakeetaipartnership #resumetips
Ritcareer
686 views•2026-05-31
3D Basics in C
HirschDaniel
2K views•2026-06-05
Re: 🗣️📍theprophedu📍2026 GST 103 CLASS (E-EXAM REVISION)
theprophedu
636 views•2026-06-04
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
Making Minecraft Clone with C++ & Raylib
PecaCSLive
686 views•2026-06-04
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Instagram accounts got PWNed
EricParker
13K views•2026-06-03
So What's Odin Lang Even Good For
TechOverTea
131 views•2026-06-01











