An object with an array of objects, and a function that returns all the names of each object in the array. This works.
 var persArr = {friends:[
     {name: "Adam", age: 37},
     {name: "Ben", age: 36},
     {name: "Chris", age: 46}],
     getFriend:function(){
         return this.friends.map(function(friend){
           return friend.name;
          }).join(', ').slice();
     }};
   var names = persArr.getFriend();
   console.log(names);
How can I return a name and age property of an object, based on search criteria?
   example: {name:"Chris", age:46}, 
            {name:"Ben",age: "36"} 
      perArr.getFriend("Chris");
 
     
     
    