About what the return value for then function for javscript promise

hello, I am reading the lesson in this link:

https://www.codecademy.com/courses/learn-intermediate-javascript/lessons/promises/exercises/chaining-promises

i am confunsed about this code and wonder what will happen to first “then” if the first promise function generate a promise that is rejected:

firstPromiseFunction()
.then((firstResolveVal) => {
  return secondPromiseFunction(firstResolveVal);
})
.then((secondResolveVal) => {
  console.log(secondResolveVal);
});

my educated guess is that it will return the old promise with intial relosved value which is the same as what firstpromisefunction return