title: Inserting value into a JavaScript file template and generating a new file
body: <p>I have a web application with a form and an number of inputs:</p>
  
  <pre><code>&lt;form action=""&gt;
      Title1:&lt;br&gt;
      &lt;input type="text" name="title1"&gt;
      &lt;input type="text" name="title1Description"&gt;
      &lt;br&gt;
      Title2:&lt;br&gt;
      &lt;input type="text" name="title2"&gt;
      &lt;input type="text" name="title3Description"&gt;
      &lt;br&gt;
      Title3:&lt;br&gt;
      &lt;input type="text" name="title3"&gt;
      &lt;input type="text" name="title3Description"&gt;
      &lt;br&gt;
      &lt;button type="button"&gt;Insert an Generate!&lt;/button&gt; 
  &lt;/form&gt;
  </code></pre>
  
  <p>I also have a JavaScript file which acts as a template:</p>
  
  <p><strong>template.js</strong></p>
  
  <pre><code>function myFunction(p1, p2) {
      return p1 * p2;
  }
  
  function mySecondFunction(p3, p4) {
      return p3 - p4;
  }
  
  var myData = {
      *title1* : {
          Title: *title1*,
          Description: *title1Description*
      },
      *title2* : {
          Title: *title2*,
          Description: *title2Description*
      },
  }
  </code></pre>
  
  <p>When a user clicks the button, how can i generate a copy of template.js insert the values the user has entered into the <em>xxxxx</em> parts of var myData,  and prompt the user to download the newly generate file?</p>
  
  <p>I can use AngularJS if this makes it easier than jQuery?</p>