title: Uncaught TypeError: undefined is not a function
body: <p>I am getting this error again and again with chrome. Though this code works fine with firefox</p>
  
  <p>here is the link to the image of error</p>
  
  <p><a href="https://www.dropbox.com/s/6ikiy5eesoxco4n/12_edited.jpg" rel="nofollow">https://www.dropbox.com/s/6ikiy5eesoxco4n/12_edited.jpg</a></p>
  
  <p>My code is as follows</p>
  
  <pre><code>function weight(w)
  {
      var Cap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
      var small = 'abcdefghijklmnopqrstuvwxyz';
      var spcl = "~!@#$%^&amp;*()_+[]\{}|;':,./&lt;&gt;?";
      var num = '0123456789';
      var p = [];
  
      for(var j=0;j&lt;w.length;j++)
          {
          if(Cap.contains(w[j])==true)
              p[j] = Cap.indexOf(w[j]) + 2;
          else if(small.contains(w[j])==true)
              p[j] = small.indexOf(w[j]) + 1;
          else if(num.contains(w[j])==true)
              p[j] = num.indexOf(w[j]);
          else if(spcl.contains(w[j])==true)
              p[j] = 1;
          }
  
      return _.reduce(p,function(memo, num){ return memo + num; }, 0); 
  
  }
  </code></pre>
  
  <p>i do not understand, why my function <code>if(Cap.contains(w[j])==true)</code> is undefined?? </p>