function getPersonPhone(id, collection){ for(var i = 0; i < collection.length; i++){ if(collection[i].id == id){ return collection[i].phone; } } } $( document ).ready(function() { });