Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

132
Vistas
hasOwnProperty returns false But The object that seems to have properties?

My JSON.stringify return empty object notation "{}" for an object that seems to have properties?

And hasOwnProperty returns false But The object that seems to have properties?

This is my properties

enter image description here:-

My JSON.stringify code:-

 const locals =JSON.stringify(action.data.displayNameLocalization);
 console.log( locals);

If my object have properties,hasOwnProperty() return false.

const test=action.data.displayNameLocalization;
console.log(test);
console.log(test.hasOwnProperty());

enter image description here

Result:-

enter image description here

I have no idea what is happening...? Anyone can help men with this..?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The hasOwnProperty() method returns a boolean indicating whether the object has the specified property as its own property (as opposed to inheriting it) so you should pass a property name when using this function.

Note, that you can use the new Object.hasOwn() static method which returns true or false indicating if the specified object has the indicated property as its own property (yet it is still not supported by all browsers)

const test = {ch : 'China', fr: 'Franch'};
console.log(test.hasOwnProperty('ch')); // checking if the property `ch` is an own property
console.log(test.hasOwnProperty()); // checking for undefined..

console.log(Object.hasOwn(test, 'ch')); // using the new Object.hasOwn method

More about hasOwnProperty - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda