Javascript examples for Array Operation:Multi Dimensional Array
If value is in multidimensional array
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w . j a va2 s. c o m var friends = [{ user: { username: 'Test' } }, { user: { username: 'Blah' } }] var matches = friends.filter(function (friend) { return friend.user.username == 'Test' }); if (matches.length > 0) { console.log(matches[0]); } else { console.log('else'); } } </script> </head> <body> </body> </html>