FAQ: JavaScript Promises - Constructing a Promise Object

Hi,
I would like to understand why we don’t invoke the myExecutor function here:
function orderSunglasses() { return new Promise(myExecutor); };

and so why this is actually running and returning a value :
function myExecutor(resolve, reject){ if (inventory.sunglasses > 0) { resolve('Sunglasses order processed.'); } else { reject('That item is sold out.'); } };

thanks for your help

Because we want the Promise to invoke it. It is passed as a reference only the same way we would pass a callback.

Why is this a = b = c, not just a=c? What purpose do the function and variable perform?

console.log(new Promise(myExecutor));

Works exactly the same, so why bother with the extra steps???

The way you type still works. The exercise just probably tried to show how arguments were passed down from myExecutor to new Promise(), I guess?

Very basic question here: why do we use Bash all of a sudden?

In a way isn’t that a good thing? It might help new developers to get a little more understanding of how we run our code using node. It can be a good starting point for some curiosity.

I’m always for learning new things, so I’m all with you here.

However, my question really is WHY we use Bash here, instead of using the coding window like we used to do up to this point? There was no explanation, no introduction of Bash and that was kinda weird.

I agree with you on this, they could have introduced bash in one or two slides. If i remember correctly, they taught us how to transpile our code in the transpilation section using bash, there i found an article about bash in some of the forum thread.
I will edit this post and add it here if I could find it again.