I have a function that checks for the current stage in a sequential stream, based on a particular discipline that is passed in, and, according to that value, assigns the nex
You are re-declaring the same variable const nextStageStep in each if block.
const nextStageStep
Juste replace const nextStageStep = 'step 2'; with nextStageStep = 'step 2'; (and all the other if cases) and it'll be all right.
const nextStageStep = 'step 2';
nextStageStep = 'step 2';