var friends= { steve: { firstName: "steve", lastName: "Sonwane", number: "9867707997", address: ['bld.no 234 N.C.H colony'] }, sunil: { firstName: "Sunil", lastName: "Sonwane", number: "9768912320", address: ['bld.no 234 t.C.H colony'] }, }; var list = function(friends){ for(var key in friends){ console.log(key); } }; var search= function(name) { for (var key in friends) { if (friends[key].firstName === name) { console.log(friends[key]); return friends[key]; } else { console.log("couldn't find them"); } } }; search("steve")
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)