The returnValue property of the HTMLDialogElement interface is a string representing the return value for a element when it's closed. You can set the value directly (dialog.returnValue = "result") or by providing the value as a string argument to close() or requestClose().
returnValue
MDN Reference