2

What do the curly braces do here in this variable definition?

const { foo } = this.bar;
Gabriel Perry
  • 21
  • 1
  • 4
  • That's called [destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment). – Bart Hofland Apr 05 '21 at 17:28
  • 2
    I suggest bookmarking [What does this symbol mean in JavaScript?](https://stackoverflow.com/q/9549780/215552) - 90% of symbols used in TypeScript are used (or are proposed to be used) in JavaScript. – Heretic Monkey Apr 05 '21 at 17:30
  • Thanks, your answers have been useful. It's Destructuring! Something that's new to me. – Gabriel Perry Apr 05 '21 at 17:45

1 Answers1

0

Javascript destructuring, explained here https://davidwalsh.name/destructuring-alias

Alexander.Furer
  • 1,817
  • 1
  • 16
  • 24