title: parse <script> tag with js/jQuery
body: <p>I have a HTML page where a user is able to edit a HTML resource (using ACE Editor). Within this HTML source, there is a <code>&lt;script&gt;</code>-tag, which does some pretty basic stuff.</p>
  
  <p>Is there any elegant solution to parse the script tag in order to (e.g.) evaluate the variables used within the script tag? For "normal" tags I use parseHTML() to have the html as a jQuery object.</p>
  
  <p>From this <strong>example</strong>, I would like to retrieve the value of $myVal (which is "<em>f00</em>") and write it to <em>#myLabel</em>:</p>
  
  <pre><code>&lt;textarea id="myScript" rows="5" readonly&gt;
    &lt;script&gt;
      $myVal = "f00";
    &lt;/script&gt;
  &lt;/textarea&gt;
  &lt;label id="myLabel"&gt;Hello&lt;/label&gt;
  
  
  $(function(){
    $scriptVar = $('#myScript').text;
    // parse the $scriptVar
    // retrieve the value of, $myVal, write it to #myLabel  
    //$myParsedValue = ???
    //$('#myLabel').text('bar!'); 
  });
  </code></pre>
  
  <p>And here is the fiddle: <a href="https://jsfiddle.net/stepdown/jqcut0sn/" rel="nofollow noreferrer">https://jsfiddle.net/stepdown/jqcut0sn/</a> </p>
  
  <p>Is this possible at all? I don't really care about vanilla js, jQuery, regex or maybe even an external library for that purpose. </p>