This was tricky to get working, so once I did, I wanted to share with everyone, in case anyone else could benefit.
I have a Multi-Line field on my form that is populated by Javascript with text formatted as comma-separated values. The user can copy-paste the contents of the Multi-Line field into a text editor, save it as a CSV file, and then import that file into another software program for processing. This works great, but I wanted to simplify it even more if I could.
So I added a button to my form that the user can click which will automatically create and download the CSV file. Here's how to do it.
By the way, this isn't supported by all browsers (for example - IE 11 doesn't support but Chrome 55 does) - the code will warn the end user if it isn't supported in their current browser and recommends them to try Chrome instead. For cross-compatibility, I had to leave the text field accessible to the user in addition to the button - so the button isn't a solution by itself, just an added feature.