I am relative new to JS and not being able to apply the promise concept to an use case I have, I checked this SO as others but could not derivate the solution for my case. I need to call promises inside a loop but only after the loop is done the next "then" should be called. Shuold this be possible in JS?
function startCooking(ingredients) {
    Utility.startConnection()
        .then(
            function (connectionTime) {             
                for (let [key, plainVector] of ingredients) {
                    encryptIngredients(plainVector)
                        .then(
                            function (encryptedBinary) {
                                return Utility.cookDinner();
                            }
                        ).then(
                            function (dinner) {                             
                                console.log(...);
                            }
                    );
                }
            }
        ).catch(
            ...
        );              
}
function encryptIngredients() {
    return new Promise(...);
}
 
    