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

171
Vistas
How does the array get updated on updating the property 'length' of the array in JavaScript?

My question is if I use an array like this,

var arr1 = [1, 2, 3, 4];
console.log(arr1.length); // 4 (Expected)

If I update the length property, the array gets updated too.

arr1.length = 0;
console.log(arr1); // []

I'd like to know how this is being done (the internals)?

Also, I'm not sure if getter and setter methods of the property length (that are ways to run a function if the property gets accessed or set) are used here. I think they're not.

If it's being used, length should not be visible directly when I expand the array in the browser console. But we get the length directly without running any functions.

The console when I use get/set for a property of an object,

using get/set

Getting the value of length property directly without running any functions,

length of array

about 4 years ago · Juan Pablo Isaza
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