0

I am not able to understand this line of code in a highcharts example

var chrt = !this.chart ? this : this.chart;

Coming from this page http://jsfiddle.net/d_paul/supgh9c1/4/

Can anyone provide a brief description of what it does?

1 Answers1

3

This is a ternary operator or simpler an if-else in one line. The same is:

var chrt = '';
if(!this.chart){
   chrt  = this
}
else{
    chrt = this.chart
}
pr1nc3
  • 6,575
  • 3
  • 15
  • 29