Javascript Promises

I’m still not understanding something about Promises and when looking at this code, I have so many questions.

How are these resolved values being passed?

Example below for beanType.
How are we passing beanType to soakTheBeans.

I’m thinking of lessons on scope and it’s confusing me.

const shopForBeans = () => {
return new Promise((resolve, reject) => {
const beanTypes = [‘kidney’, ‘fava’, ‘pinto’, ‘black’, ‘garbanzo’];
setTimeout(()=>{
let randomIndex = Math.floor(Math.random() * 5);
let beanType = beanTypes[randomIndex];
console.log(I bought ${beanType} beans because they were on sale.);
resolve(beanType);
}, 1000)
})
}

let soakTheBeans = (beanType) => {
return new Promise((resolve, reject) => {
console.log(‘Time to soak the beans.’);
setTimeout(()=>{
console.log(... The ${beanType} beans are softened.);
resolve(true);
}, 1000);
});
}

let cookTheBeans = (isSoftened) => {
return new Promise((resolve, reject) => {
console.log(‘Time to cook the beans.’);
setTimeout(()=>{
if (isSoftened) {
console.log(’… The beans are cooked!’);
resolve(’\n\nDinner is served!’);
}
}, 1000);
});
}