find an object comprising multiple key/value pairs in a javascript array? - Javascript Array Operation

Javascript examples for Array Operation:Array of Object

Description

find an object comprising multiple key/value pairs in a javascript array?

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){// w ww  . j  a v a  2 s. c o m
var objects_found = [];
var entry = {any_number:7,  any_text:"P1"}; 
var entry1 = {any_number:8, any_text:"T1"};
objects_found.push(entry);
objects_found.push(entry1);
console.log(objects_found.indexOf(entry1));
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials