-4
  const lastTick = this.xAxis[0].ticks[this.xAxis[0].tickPositions.length - 1];
  const { width } = lastTick.label.getBBox();
  const { chartWidth } = this;
  lastTick.label.attr({ x: chartWidth - (0.7) * width });

This is highcharts code. I want meaning of { width } , { chartWidth }.

Ivan
  • 1,487
  • 1
  • 16
  • 27
  • This is Destructuring. `const { chartWidth } = this;` is just `const chartWidth = this.chartWidth;` – Ivan Jun 03 '20 at 07:28

1 Answers1

-1

It's called Destructuring assignment. It is similar to writing

const chartWidth = this.chartWidth;
const width = lastTick.label.getBBox().width;
ruth
  • 29,535
  • 4
  • 30
  • 57
  • 2
    Not sure, but likely because you are answering an obvious duplicate question. Answering it again and again is not useful. – E_net4 Jun 03 '20 at 07:31
  • When I opened the question it was not clear to me that it was a duplicate (no votes yet) and the answer seemed legit as well. It seems off down voting the answer while not closing the question yet. – Rob Audenaerde Jun 03 '20 at 07:34
  • 1
    @RobAu so we can only tell it's a duplicate if someone else has voted to close it as a duplicate? How does that get started, how does the first person (hi!) figure it out? As a rule of thumb, if you think "that seems really obvious, I can't believe nobody has asked it before": they probably have, go find it. – jonrsharpe Jun 03 '20 at 07:40
  • @jonrsharpe *you* can probably tell easily; I never saw this before, clicked the link and learned something. But I get that if its obvious to the more experienced JS developer, it's a logical thing to do. Thanks for the clarification. – Rob Audenaerde Jun 04 '20 at 07:38