SOURCE

// code challenge
var student = [
  {
      'fristName' :'shen',
      'lastName':'Li',
      'number':'unknown',
      'like':['javascript','play baksetball','write code']
  },
    {
      'fristName' :'shen2',
      'lastName':'Li2',
      'number':'unknown',
      'like':['javascript','play baksetball','write code']
  },
    {
      'fristName' :'shen3',
      'lastName':'Li3',
      'number':'unknown',
      'like':['javascript','play baksetball','write code']
  },
];
// 编写 查询函数
function Queryinfo(name,prop){
    for(var i = 0; i < student.length;i++){
       if(student[i].fristName === name){
           return student[i][prop] || '没有找到属性';
       }
    }
    return '没有找到该联系人';
}

var data = Queryinfo('shen2','lastName');

console.log(data);
console 命令行工具 X clear

                    
>
console