title: Underscore.js - Uncaught ReferenceError: x is not defined
body: <p>I keep getting this Uncaught ReferenceError: x is not defined error when my script is trying to render a template. This script is using combinations of backbone.js, require.js, underscore.js, and jquery.js. I have spent a day trying to debug and search for answers online. Does anybody know what is going on?</p>
  
  <p>Code:</p>
  
  <pre><code>define([
      'jQuery',
      'Underscore',
      'Backbone',
      'text!templates/sharingFactory.html'
  ], function($, _, Backbone, SharingFactoryTemplate) {
      console.log('in SharingFactoryItemView');
      var SharingFactoryItemView = Backbone.View.extend({
          tagName: "span",
          initialize: function() {
              console.log('in initialize');
              this.template = _.template(SharingFactoryTemplate);
              console.log(this);
              this.render();
          },
          render: function () {
              console.log('in render');
              var data = this.model.toJSON();
              console.log(data);
              this.$el.html(this.template(data));
              return this;
          }
      });
  
      return SharingFactoryItemView; 
  });
  </code></pre>
  
  <p>Console Log:</p>
  
  <pre><code>in initialize SharingFactoryItemView.js:14
  child
   SharingFactoryItemView.js:16
  in render SharingFactoryItemView.js:20
  Object
   SharingFactoryItemView.js:22
  Uncaught ReferenceError: x is not defined
  </code></pre>