Variable declaration with "{}" in JavaScript

·

1 min read

I saw a code I don't know like "const { props } = this". What is "{}" mean?

It is one of syntax in "destructuring assignment" in JavaScript ES6.

For example

You can rewrite this.

const title = post.title
const date = post.date
const tags = post.tags

As this.

const { title, date, tags } = post