How to pass variables between Cypress tests

Sometimes it is valuable to pass variables between test scripts in Cypress. You can exchange values between spec files by utilizing the cy.task() function.