I have a series of promise functions that I'm chaining together. I don't need the specific result from the previous function so I'm not adding anything into resolve(); I just need them to run sequentially.
However, there is a variable in the containing scope that I want to pass into the first and fourth(last) promise. When I add it as a parameter to the third promise, the function runs immediately.
How can I pass a parameter into a chained promise and not call the function/promise at that time?
Here is the basics of what I'm trying to do:
const containingFunction = function() {
        const varToPass = document.querySelector("#ID").value.trim();
        firstPromise(varToPass)
            .then(secondPromise)
            .then(thirdPromise)
            .then(fourthPromise(varToPass))
            .catch(e =>{
               console.error(e)); 
            } );
    };
FourthPromise:
    const fourthPromise = function(varPassed) {
            return new Promise(function(resolve, reject) {
                do some stuff but only after the thirdPromise has been resolved
                console.log(varPassed)
                resolve();
            });
        };
 
    