I was recently in an interview for javascript and was asked what I though was an easy question.
The interviewer ask me to explain promises.
...Well I though inside this is easy... I got this.
...Welp needless to say things didn't go as I expected.
What are Promises in JavaScript
Promises are objects used to run code asynchronously.
To keep in simple. We can defer the completion of a block of code until the async request is complete.
Promises also have what I like to call a fail safe in the .catch method. Which simply put will catch the errors in our async call.
Promises are becoming more useful with us running more and more things asynchronously. Having the ability to catch our errors in one place is extremely important as we develop as developers.
I hope this helps and if you get this question in an interview..good luck
Happy Coding π¨πΏβπ»π¨π»βπ»π©βπ»π§πΎβπ»
Top comments (0)