title: Trouble creating JavaScript object from different file
body: <p>I have looked through some answers here and none have helped.
  I'm new to javascript and I am trying to create a new object with some data from inside a script tag in an HTML document, and the object is defined in another file.</p>
  
  <p>relevant information in HTML file: (this is all in the <code>&lt;head&gt;</code> tag)</p>
  
  <pre><code>&lt;script type="text/javascript" src="data.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="paper-full.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="howler.core.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="circles.css"&gt;
  &lt;script type="text/paperscript" canvas="myCanvas"&gt;
  
      var keyData = new Data();
  
      function onKeyDown(event) {
          var colour = "orange";
          if(keyData.data[event.key]){
              keyData.data[event.key].sound.play();
              colour = keyData.data[event.key].colour;
          }
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>my data.js file:</p>
  
  <pre><code>function Data(){
      var data = {
      q: {
          sound: new Howl({
          src: ['sounds/bubbles.mp3'],
          volume: 0.3
          }),
          colour: '#1abc9c'
      },
      w: {
          sound: new Howl({
          src: ['sounds/clay.mp3'],
          volume: 0.3
          }),
          colour: '#2ecc71'
      }, ... LOTS MORE DATA
  ...
  }
  </code></pre>
  
  <p>Whenever I press a key on my keyboard I get an error in the chrome developer console: </p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'e' of undefined
  at Tool.onKeyDown [as _onKeyDown] (&lt;anonymous&gt;:11:38)
  at Tool.emit (paper-full.js:662)
  at emit (paper-full.js:12866)
  at CanvasView._handleKeyEvent (paper-full.js:12874)
  at handleKey (paper-full.js:13120)
  at HTMLDocument.keypress (paper-full.js:13148)
  </code></pre>
  
  <p>which looks strange to me since it appears to be saying that 'e' is a property when it should be a key.</p>
  
  <p>I'm new to JavaScript so I'm not too confident in splitting code into multiple files.</p>
  
  <p>bonus: if someone could explain to me how to move my text/paperscript script to a separate file and not break everything that would be fantastic.</p>
  
  <p>Thanks.</p>