Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Agnieszka Niemiec7,359 Points
Where is nextValue parameter getting its value from?
How does it work, that the function finalValue knows the value of nextValue? I'm sorry if my question makes no sense. I'm having trouble understanding how does the program know which values to use as arguments...
const value = 5; mathPromise // the first function addFive recive as argument/value the variable value (in this example is 5). .then(addFive) // 5 + 5 // the next function double that is called recive as argument/value the result of last function called. last function was addFive (function get 10 as argument) .then(double) // 10 * 2 // the next function called is addFive that will recive the argument/value the result of doblue function (function get a 20 as argument) .then(addFive) // 20 + 5 // the result of the secound addFive function is argument/value for the finalValue function (function recive 25 as argument/value ) .then(finalValue) .catch( err => console.log(err) )