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

167
Vistas
Javascript const object syntax - what is this doing? (using in a Vue script)

What is the following statement doing, and why use const vs var?

const { SearchIcon } = myApp.icons;

For context, I am learning Vue and new to Javascript. I saw this in an example. The SearchIcon is an icon that is being imported from heroicons, MyApp.icons is being defined in a different script file like this:

window.MyApp = {
    app: null,
    icons: {},
...
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Looks like your issue is that you're storing MyApp under window, but then trying to access it directly. You've also got a capital M in the definition, and a lowercase when your accessing it.

Here's a working example:

window.MyApp = {
  app: null,
  icons: {
    SearchIcon : 'Hello!'
  },
};

const { SearchIcon } = window.MyApp.icons;

console.log(SearchIcon);

For more info, see the docs on object destructuring.

Hope that helps :)

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