title: pass value from node.js to javascript
body: <p>I'm trying to work with Google's example code: <a href="https://github.com/googlesamples/google-photos" rel="nofollow noreferrer">PhotoFrame</a>.
  It is built with node.js, expressjs, jQuery, etc.
  I need to pass a variable -- let's call it myString -- from app.js to one of the .js files -- let's call it myScript.js.
  I've tried at least a dozen approaches that I found at StackOverflow and elsewhere. None has worked.</p>
  
  <p>Some folks have said "just use a global, even though they're 'BAD'.
  In app.js you:</p>
  
  <pre><code>global.myStringGlobal = myString
  </code></pre>
  
  <p>and in myScript you:</p>
  
  <pre><code>var myStringLocal = myStringGlobal;
  </code></pre>
  
  <p>Doesn't work: myStringGlobal is undefined.</p>
  
  <p>Some folks say: code a little object in app.js and module.export it.
  Them require it in myScript. Doesn't work: require is undefined in myScript.
  In fact, since myScript and myOtherScripts run in the browser, require
  is simply un-available.</p>
  
  <p>Some folks say code this in app.js:</p>
  
  <p><code>res.render(page, {myString: myString});</code></p>
  
  <p>Others say "No, that sends myString to the html renderer; not to myString.
  They're correct. </p>
  
  <p>I won't drag this out by telling you the other ways I tried in vain.</p>
  
  <p>This question has been asked and answered many times in various ways,
  but none of the answers work -- anymore? or who knows why?</p>
  
  <p>So I ask again: does anyone know how to pass a variable from the node.js
  app.js script to some myScript.js file?</p>