var Student={
student_name:"Ricky",
student_surname:"Martin",
student_age:28,
}
function checkProp(Obj,prop){
if(prop in Obj){
return Obj.prop;
}else{
return "Sorry";
}
}
console.log(checkProp(Student,Student["student_age"]));
the value of Student["student_age"]
is 28
, so the function is checkig for a proeprty with name 28
2 Likes
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.