Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!