Javascript中使用大括号和方括号的常量声明

Javascript中使用大括号和方括号的常量声明,javascript,node.js,reactjs,google-cloud-storage,Javascript,Node.js,Reactjs,Google Cloud Storage,我已经看到了const的用法,如下面ReactJS中的代码所示。到目前为止,我知道它是关于从这个和 情景1 class DoSomething extends Component() { constructor() { this.state = { jump: '' } } function somethingSmall() { // I can access the state with the declaration that uses th

我已经看到了const的用法,如下面ReactJS中的代码所示。到目前为止,我知道它是关于从这个和

情景1

class DoSomething extends Component() {
  constructor() {
    this.state = {
      jump: ''
    }
  }

  function somethingSmall() {
    // I can access the state with the declaration that uses the curly braces
    const { jump } = this.state;
  }
}
在下面的示例中,我在使用NodeJS时注意到了这一点,它还使用了const。我试图在将文件上载到时访问元数据

场景2

bucket = storage.bucket(bucket_name);
bucket.upload(filepath)
.then(() => {
  var uploaded_file = bucket.file(filename);
  const [ metadata ] = await uploaded_file.getMetadata()
 }
)

请澄清花括号和方括号的用法。任何帮助,包括进一步阅读的链接,都将不胜感激。

{}在从对象解构时应使用,而[]在从数组解构时应使用

{}
在从对象解构时使用,而
[]
在从数组解构时使用