Yes it is possible, in the Modified JavaScript step there is a button called Get Variables, you can click on it and all the variables declared in the JavaScript will appear as an output, so select the desired variable and pass it to the next step.
I’ve attached the screenshot for your reference.