download text file in javascript
<p>Like the title is saying, I'm trying to download a text file in javascript. Best way would be a .docx file but .txt is ok. I saw the blob framework and tried it but doesn't work.. Looks like it can't save my file.</p>

<p>My code to save my text file:</p>

<pre><code> function totxt(){
      var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
      saveAs(blob, "helloworld.txt");
 }
</code></pre>