How Regex works

Asked by Subhadip Chatterjee about a year ago


Please explain about regex and promises

2 Answers


    Regex and Promises are two totally different concepts!

    You can find about more of regex here:

    and about Promises here:

    do let me know if you need any detailed explanation.


    Rushikesh Khilari



    A promise may have one of three states.

    Pending Fulfilled Rejected A promise starts in a pending state. That means the process is not complete. If the operation is successful, the process ends in a fulfilled state. And, if an error occurs, the process ends in a rejected state.

    Create a Promise To create a promise object, we use the Promise() constructor.

    let promise = new Promise(function(resolve, reject){ //do something });

    The Promise() constructor takes a function as an argument. The function also accepts two functions resolve() and reject().

    If the promise returns successfully, the resolve() function is called. And, if an error occurs, the reject() function is called.


    Suhel Ahmed


Your answer