There are parts not working and I don’t understand why we need to rename property to checkProp, isnt it unnecesary?
Your code so far
function checkObj(obj, checkProp) {
// Cambia solo el código debajo de esta línea
if (checkObj.hasOwnProperty(checkProp)){
return obj[checkProp];
}else {
return "Not Found";
}
}
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift");
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet");
checkObj({city: "Seattle"}, "city");
// Cambia solo el código encima de esta línea
Your browser information:
El agente de usuario es: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Challenge Information:
JavaScript básico - Verifica las propiedades de un objeto
It’s just listed in the Spanish JS section. If you use the curriculum in that language it will open the help thread in the appropriate language section (I assume).
Ok, so this is my code and its not working, any ideas?
function checkObj(obj, checkProp) {
// Cambia solo el código debajo de esta línea
if (checkObj.hasOwnProperty(checkProp)){
return obj[checkProp];
}else {
return "Not Found";
}
}
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift");
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet");
checkObj({city: "Seattle"}, "city");
// Cambia solo el código encima de esta línea
is not working because there is an error in the if statement. The checkProp variable should be checked against the obj parameter, not against checkObj.