Promise

Promises in JavaScript specifies completion or failure of an event or asynchronous tasks i.e either tasks will be pending,complete or rejected.To create a promise New keyword is used after that a callback function is written which takes take two arguments one resolve and the other is reject.If tasks completed successfully resolve will come into play else reject will execute.If we want to console the task either it is completed or rejected it can be check using event handlers try and catch or .then and .catch method if tasks is resolved then try or .then will console the data otherwise error will execute in the catch block