Verificar propiedades de un objeto

Cuéntanos qué está pasando:
Describe tu problema en detalle aquí.

Sigo todos los pasos, pero me sigue diciendo que checkObj{pet:“kitten”, bed:"sleigh}“gift”} debe devolver not found.
Se contradice? Si la sentencia if es true no va a devolver not found.
Tu código hasta el momento


function checkObj(obj, checkProp) {
// Cambia solo el código debajo de esta línea
var myObj ={
  gift: "pony",
  pet: "kitten",
  bed: "sleigh",
  city: "Seattle"
};
if (myObj.hasOwnProperty(checkProp)){
  return myObj[checkProp];
} else if (myObj.hasOwnProperty(checkProp) !== true){
  return "Not Found";
}  else{
return "Change Me!";}

// Cambia solo el código encima de esta línea
}
  **Información de tu navegador:**

El agente de usuario es: Mozilla/5.0 (Linux; Android 6.0; LG-H650) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.88 Mobile Safari/537.36

Desafío: Verifica las propiedades de un objeto

Enlaza al desafío:

Why is this here?

You should use the function argument, obj.

Hola, tengo el mismo problema. Alguien lo ha podido resolver? gracias

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.