Using Firefox's Web Console Editor Mode
Open Tools > Web Developer > Web Console.
You can also access the web console via the keyboard shortcut CTRL+SHIFT+K.
The console appears at the bottom of the screen and shows the current web page's code. Enter the multi-line editing mode by clicking the arrows on the lower left side of the console.
You can also access multi-line editing via the keyboard shortcut Ctrl + B (Cmd + B on macOS).
Type your code into the editor. Use Enter to add new lines, or use CTRL+Enter to run them.