How do i report blocks with JSfunction

i wanted to make a block with JS code

var r = confirm("Press a button!");

and it will return true if the user clicked OK
how do i make it?
basically i wanted JS vars to get collected into snap

Just use:

return confirm("Press a button!");

with the return keyword and whatever afterwards.
(I hope I understood your question right.)

thank you, that helped me a lot

i was also thinking about using variables with return

can @bh close this topic? it is already solved.

Yes:

var confirmValue = confirm("Press a button!");
return confirmValue;

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.