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

265
Vistas
javascript - console.log prints an array with its brackets " [ ]" and not just the content

I have this code

var family = ["Jullia", "James", "Eva"];
console.log(family);

And as you can see, when you run the code, it prints the brackets as well. Why?

(I am new to javascript so i know that this might seem like a stupid question to ask..)

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

0

This is simply how your console has chosen to represent arrays—by writing each element enclosed in brackets. It helps the programmer know that what has been printed is an array of elements. I would not rely on this "stringified" version, though, if you're trying to print names in a specific way.

To do that, I would suggest learning about Array.join() (reference), where the examples do exactly as you might want.

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