codedamn

How Regex works

Asked by Subhadip Chatterjee about a year ago

0

Please explain about regex and promises

2 Answers

    2

    Regex and Promises are two totally different concepts!

    You can find about more of regex here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions

    and about Promises here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

    do let me know if you need any detailed explanation.

    @curator

    Rushikesh Khilari

    @curator

    0

    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.

    @suhelahmed114

    Suhel Ahmed

    @suhelahmed114

Your answer