Help for chapter on Promises

Hi, Can anyone help to clarify the following code that was used as an example in the video by Ivan on promises?

When the promise function is called by .then(function(), are all of the statements inside of the curly brackets (e.g. console.log(“Reading from database”):wink: then passed to resolve argument inside of the function?

It wasn’t quite broken down how console.log was passed to resolve.

I am right at the end of the chapter and cannot complete this section until I thoroughly understand it. All help will be very much appreciated.

// WRITE PROMISE

    var promise = new Promise(function(resolve, reject){

       // WRITE PROMISE CODE

       // CONNECT TO DATABASE

       setTimeout(resolve,2000);

    })

    promise.then(function(){

        console.log("Connecting to database");
    }