title: Jquery object search
body: <p>I have the following object and what I would like achieve is to get the index of theme if the name has match with a variable.</p>
  
  <p>for example: I'm making a loop in the views and if my task (<code>something1</code>) variable has matches with the name element than to return the index of object.</p>
  
  <p>By the given example I should have as result 0,</p>
  
  <pre><code>var views = [
  
      {
          name: "something1",
          type: something1,
          columns: something1
      },
  
      {
          name: "something2",
          type: something2,
          columns: something2
      },
  
      {
          name: "something3",
          type: something3,
          columns: something3
      }
  
  ];
  
  
  var task = 'something1';
  
  $.each(views, function(index, value) {
  
      if (value.name = task) {
          alert(index);
      }
  
  }); 
  </code></pre>