title: How to export a result from Javascript to a csv file?
body: <p>I am trying to calculate a person's typing speed and then store it in an csv file. I can calculate the speed using a JavaScript program, but I do not know how to export the speeds to a csv file. I tried using Papaunparse, but that did not work. It's a server side csv file, called stats. </p>
  
  <p>The speed variable is called spd. 
  Below is a snippet of the code that calculates the speed and displays it to the user. </p>
  
  <pre><code>    clearTimeout(myTimer);
      dayTwo = new Date();
      endType = dayTwo.getTime();
      totalTime = ((endType - startType) / 1000)
      spd = Math.round((word/totalTime) * 60)
      given = document.theForm.given.value.split(" ")
      typed = document.theForm.typed.value.split(" ")
      correct = 0
      len = 0 
      if(typed.length &gt; given.length){
          len = typed.length
      }
      else{
          len = given.length
      }
      for (var i = 0; i &lt; len; i++) {
          if(typed[i] === given[i]){
              correct += 1
          }
      }
      alert("\nYou got " + correct + "/" + given.length + "correct. \nYou typed a " + given.length + " word sentence in " 
      + totalTime + " seconds, a speed of about " + spd + " words per minute!" );
  </code></pre>
  
  <p>If someone could tell me how to export this speed to a csv file, it would be wonderful! Thanks for any help! :) </p>