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

180
Vistas
Deleting a non-string in js object

Let's say I have the following object:

const a = {a: 1, 0: 2};
delete a.a; // this works
delete a.0; // this errors (I suppose expecting a['0'] and not a[0])

Does the method deletion form of obj.key only allow deletion of a string key? And if it's a non-string type, is the only way of doing deletion via the key lookup method of obj[key] ?

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

0

According to MDN:

In the object.property syntax, the property must be a valid JavaScript identifier.

... where ...

... identifiers are case-sensitive and can contain Unicode letters, $, _, and digits (0-9), but may not start with a digit.

So, answering your question, property with name 0 can be only accessed with key notation.

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