title: Javascript - getting a particular object from list based on property value
body: <p>I have a javascript   json result  list - self.data.allOrganizationsList</p>
  
  <p>self.data.allOrganizationsList contains list of organization whose properties are </p>
  
  <pre><code>customentityaccess, id, isLabsAccessAllowed, memberCount, organizationname, organizationwebsite
  </code></pre>
  
  <p>i want to access an organization object which has 
  id = 402881702121fec10121520080930001</p>
  
  <p>I am trying to get this from the below statement, but since each item in the list is an object, i am unable to get the desired result.</p>
  
  <pre><code>self.data.allOrganizationsList.id['402881702121fec10121520080930001']`
  //(or)
  self.data.allOrganizationsList["id"]['402881702121fec10121520080930001']
  </code></pre>
  
  <p>Other alternative is to use the  $.each(self.data.allOrganizationList, function(index, item)).</p>
  
  <p>But can i achieve the above result without iterating the - self.data.allOrganizationList</p>
  
  <p>From the $.grept()</p>
  
  <pre><code>var myvar = $.grep(response.permissionedOrganizations, function(v) {
              return v.id === '40288170227c142201227eb56c5c000a';
          })[0];
  console.log(myvar);
  </code></pre>
  
  <p>displays  undefined in console. Am i missing something.</p>