-1

I know how to declare const variable like const a = 1;

but I dont get what is this

const { app, BrowserWindow } = require('electron')

can anyone explain me?

Yan Myo Aung
  • 398
  • 1
  • 6
  • 18
  • 1
    JavaScript destructuring, allows you to declare multiple consts from the one value / module. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment – andy mccullough Jul 16 '19 at 04:12
  • here `app` and `BrowserWindow` both variables are available inside electro package as objects. So you can directly take it's object variables into main variables. Check here. It will help you understand better https://stackoverflow.com/a/44905538/4156021 – Ankur Jul 16 '19 at 04:13
  • duplicate of :- https://stackoverflow.com/questions/44732946/what-does-app-browserwindow-means-in-javascript-node-js/44733043 – Ameerudheen.K Jul 16 '19 at 04:17

1 Answers1

-1

That’s a destructuring assignment.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

It lets you make shortcuts to members of an array or structure.

VorpalSword
  • 1,223
  • 2
  • 10
  • 25