What is Promise in Java Script

Hello friends today i am discuss about promise in java script. The Promise in java script is there is three condition first one is pending, reject or resolve.

There are three types of Promises property.

  • Pending
  • Fulfilled
  • Rejected
<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Promises in java script</title>


        console.log("Check Promise Function");

        function fun1() {
            return new Promise(function(resolve, reject) {
                setTimeout(() => {
                    const error = true;
                    if (!error) {
                        console.log("There is error");
                    } else {
                        console.log("this is reduclse");
                    console.log("Hello Set Time out function");
                }, 1000);



Leave a Comment