A promise is an article that may 🌌 produce a solitary worth at some point 🕠 later on 📅 with either a settled 💯value or a cause 💬 that it's not 😐 resolved.*
𝐈𝐭 𝐰𝐢𝐥𝐥 👏 𝐛𝐞 𝗳𝗮𝗹𝗹𝗶𝗻𝗴 𝗨𝗻𝗱𝗲𝗿 𝐨𝐧𝐞 ☝️ 𝐨𝐟 𝐭𝐡𝐞 𝟑 𝐩𝐨𝐬𝐬𝐢𝐛𝐥𝐞 𝐬𝐭𝐚𝐭𝐞𝐬:
👉𝐏𝐞𝐧𝐝𝐢𝐧𝐠: This is an initial stage of the Promise 🤞 previously 🤔 an operation 💁 starts.
👉𝐅𝐮𝐥𝐟𝐢𝐥𝐥𝐞𝐝: This state demonstrates that 🔀 the specified operation was finished. ✅
👉𝐑𝐞𝐣𝐞𝐜𝐭𝐞𝐝: 🚫 This state 🇺🇸 demonstrates that 👉 the operation 💁 didn't finish. In 😩 this case, a blunder 🚫 esteem 👇 will be thrown🙀.
Promises are utilized 🚟 to deal with nonconcurrent activities.
They give 👋 an another way to deal with callbacks by lessening ⏬ the callback hell and composing the cleaner code💻.
🤞 A promise is an item that 🍜 supplies a standard-consistent .then() method
🤞A forthcoming promise might change into 🤓 either satisfied or dismissed by the state.
🤞A satisfied or dismissed 🚫 promise 🤞 is settled and it should not ⚙️ change into 👉 any 🕺 other state.
👆Once a promise 🤞 is settled, the worth 💵 should not ✖️ change.
Since .then() consistently returns another promise, it's feasible to chain promises with exact power over how and where blunders are taken care of. Promises permit you to imitate typical simultaneous code's attempt/get conduct.
A callback function is a function passed into 🚟👉 one more function as a contention.
This capacity is conjured inside 💠 the external function to finish an activity. 🎬
The principle Difference between Callback-functions and Promises is that we Attach a Callback-function to a Promise instead of passing it.
So we actually use callback functions with Promises, yet in an unexpected way (chaining).
Hope you found it useful...