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

153
Vistas
how does usage of braces change the value in javascript?

I have the below Javascript code:

const product = await productsRepo.getOne(req.params.id);
console.log(product);
console.log({product});

Output from first console.log.

{ title: 'hey12up', price: 1234, image: '', id: 'b6ff5da7' }

Output from second console.log:

{
  product: { title: 'hey12up', price: 1234, image: '', id: 'b6ff5da7' }
}

Though I understand that in the second output, product is a key and the value is an object (which are further key-value pairs), I dont understand how this conversion is done?

Just by enclosing the object name "product" inside braces, what is happening? Is there any technical term for this?

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