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

221
Vistas
Destructuring in named export?

In javascript,I import a named object like this:

import {my_object} from './my_js.js'

Is some sort of destructuring happening in this above mentioned import statement or using curly braces is just a requirement for importing named object?

thanks in advance

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

0

Although the syntax looks very similar to destructuring, and the operation being performed is somewhat similar to destructuring (in that it takes the my_object binding from the namespace and puts it into an identifier), it's something quite distinct. For a couple of examples...

With destructuring, you can destructure nested properties of an object. This is impossible to do (in one statement) with imports.

With destructuring, you can put the property into a different variable with a colon. With imports, as must be used instead.

const { prop: propIdentifier } = obj;
import { theName as theNameIdentifier } from './somefile';

using curly braces is just a requirement for importing named object?

Exactly.

There are things you can do with destructuring that you can't do when importing, and there are things you can do when importing that you can't do with destructuring.

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